Counting With Two Digits
Binary uses only 0 and 1. Each position is a power of two rather than a power of ten, so 10110101 means:
128 + 0 + 32 + 16 + 0 + 4 + 0 + 1 = 181
Computers use binary because transistors have two stable states. Everything else — text, images, instructions — is a convention layered on top of that.
Place Value Chart
| Bit position | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Place value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| Example: 10110101 | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 |
Converting
Binary to decimal: add the place values wherever a 1 appears.
Decimal to binary: divide repeatedly by 2 and read the remainders backwards. 181 ÷ 2 = 90 r1, 90 ÷ 2 = 45 r0, 45 ÷ 2 = 22 r1, and so on — giving 10110101.
Binary to hexadecimal: group the bits in fours from the right and convert each group. 1011 0101 becomes B5. This exact correspondence is why hex exists in computing.
Binary Arithmetic
Addition follows four rules: 0+0=0, 0+1=1, 1+0=1, and 1+1=10 — write 0, carry 1. Multiplication is simpler still, since multiplying by 0 or 1 requires no memorised table. This simplicity is what makes binary hardware fast.
Negative Numbers and Two's Complement
Computers represent negatives using two's complement: invert every bit and add one. In 8 bits, −5 is stored as 11111011. The advantage is that subtraction becomes addition, so the same circuit handles both. It also explains why signed 8-bit values run from −128 to 127 rather than −127 to 127.
Why Byte Sizes Are What They Are
| Bits | Values | Common use |
|---|---|---|
| 8 (a byte) | 256 | One character, one colour channel |
| 16 | 65,536 | Unicode range, older audio |
| 32 | 4.29 billion | IPv4 addresses, standard integers |
| 64 | 1.8 × 1019 | Modern integers, memory addresses |
The 2038 problem is a direct consequence: 32-bit signed Unix timestamps overflow on 19 January 2038.
Frequently Asked Questions
Why do computers use binary rather than decimal?
Two states are easy to distinguish reliably in hardware — voltage high or low. Ten states would require far tighter tolerances and give little benefit.
What is the largest number in 8 bits?
255 unsigned, or 127 signed. This is why so many older games capped values at 255.
How do computers store decimals in binary?
Using floating point, which stores a sign, an exponent and a fraction. Some decimal values, including 0.1, cannot be represented exactly — which is the source of the familiar 0.1 + 0.2 = 0.30000000000000004 result.