Topic 1 · Data representation
Why computers use binary
The big idea
Inside a computer, everything is a switch that is either off or on. Billions of tiny transistors in the processor and memory each hold one of two states. We write those two states as 0 and 1.
A number system that uses only 0 and 1 is called binary (base 2). That's why computers use binary for all data: numbers, letters, photos, music, videos and the programs themselves. Before a computer can process any data, it has to be turned into binary.
In one sentence: computers use binary because their circuits (logic gates and registers) only have two states, on and off, and binary only needs two digits.
Three number systems you need
| System | Base | Digits it uses | Where you see it |
|---|---|---|---|
| Denary | 10 | 0 1 2 3 4 5 6 7 8 9 | Everyday counting |
| Binary | 2 | 0 1 | Inside the computer |
| Hexadecimal ("hex") | 16 | 0–9 and A B C D E F | A short way for humans to write binary |
Place values
In denary, each column is worth 10 times the one to its right: ones, tens, hundreds…
Binary works the same way, but each column is worth 2 times the one to its right. For an 8-bit number the place values are:
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|
To read a binary number, add up the place values that have a 1 under them.
Example: what is 01001010 in denary?
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 |
64 + 8 + 2 = 74
Try it yourself with the bits below: tap them to switch them on and off.
Bits, nibbles and bytes
- A bit is one binary digit (a 0 or a 1).
- A nibble is 4 bits.
- A byte is 8 bits.
The biggest number you can store in 8 bits is 11111111 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. So one byte can hold 256 different values (0 to 255).
Key terms
| Term | Meaning |
|---|---|
| Binary | A base-2 number system that uses only the digits 0 and 1 |
| Denary | A base-10 number system (the one we use every day) |
| Bit | A single binary digit |
| Byte | A group of 8 bits |
| Register | A small, very fast storage location inside the CPU that holds binary values |
Quiz
Quick check: why binary
4 questions