Binary Numbers Explained
Everything on your computer, from photos to this page, is stored as 1s and 0s. Learn to read and write binary in a few minutes.
Place values: tens vs twos
Our normal numbers are base 10: each place is worth 10 times the one to its right (ones, tens, hundreds…). Binary is base 2: each place is worth twice the one to its right, and the only digits are 0 and 1.
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 1 | 0 | 1 | 1 | 0 | 1 |
- Add the place values wherever there's a 1
- 32 + 8 + 4 + 1
- = 45
Decimal to binary
Work from the biggest place value down. If it fits, write 1 and subtract; if not, write 0.
- 128 doesn't fit → 0
- 64 fits → 1 (36 left)
- 32 fits → 1 (4 left)
- 16 → 0, 8 → 0
- 4 fits → 1 (0 left)
- 2 → 0, 1 → 0
- 100 = 01100100
Counting in binary: 0, 1, 10, 11, 100, 101, 110, 111, 1000… Each time a column fills up, it rolls over, just like 9 rolling over to 10.
Bits, bytes and why computers use binary
A computer is built from billions of tiny switches that are either on or off, so two digits are all it needs. One binary digit is a bit; eight bits make a byte, which can store 256 different values (0–255).
| Unit | Size | Roughly holds |
|---|---|---|
| 1 byte | 8 bits | One letter of text |
| 1 kilobyte (KB) | 1,000 bytes | A short paragraph |
| 1 megabyte (MB) | 1 million bytes | A photo (compressed) |
| 1 gigabyte (GB) | 1 billion bytes | About an hour of HD video |
Programmers often write binary in hexadecimal (base 16, digits 0–9 then A–F) because one hex digit equals four bits: 1111 1111 = FF = 255. You'll see it in colour codes like #0F7A6C.
Click the bits to flip them, or type a number.