ideabehindit
Electronics and computers

Binary numbers and number bases

Computers store every number, letter, photo and song as patterns of 0s and 1s, because a switch can only be off or on. Watch eight switches count from 0 to 255, then use the slider to write the same number in other bases.

The idea behind it

Our everyday numbers are base 10: ten digits, 0 to 9, and each place is worth ten times the place to its right. That is only a habit, probably from counting on ten fingers. Any number of digits works the same way.

Binary is base 2. With two digits, each place is worth twice the one to its right. So 1011 in binary means 8 + 0 + 2 + 1 = 11.

Bases you will meet

BaseDigitsUsed for
2 (binary)0 1Inside every computer and phone
8 (octal)0 to 7File permissions on Linux, older computers
10 (decimal)0 to 9Everyday counting
16 (hexadecimal)0 to 9, A to FColours on web pages (#FF8800), memory addresses

Eight bits make a byte, which can hold 256 different values (0 to 255). That is why 255 turns up so often in computing.

In more detail

Everything a computer stores is turned into binary. Letters use codes: in the ASCII and Unicode systems the letter A is 65, which is 01000001. A photo is a grid of pixels, each stored as three numbers for red, green and blue, usually 0 to 255 each. A kilobyte is about a thousand bytes, a megabyte about a million and a gigabyte about a billion, so a 128 GB phone can hold around a trillion bits. Hexadecimal is popular with programmers because each hex digit stands for exactly four bits, making long binary numbers easier to read.