Our system is base 10
We count in base 10 (decimal): ten digits, 0–9, and each place is worth 10 times the place to its right.
| Thousands | Hundreds | Tens | Ones |
|---|---|---|---|
| 10³ | 10² | 10¹ | 10⁰ |
Why 10? Probably because we have 10 fingers. But any whole number greater than 1 can be a number base.
Binary: base 2
Binary uses only two digits: 0 and 1. Each place is worth double the place to its right.
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 2⁷ | 2⁶ | 2⁵ | 2⁴ | 2³ | 2² | 2¹ | 2⁰ |
Computers use binary because electronic switches have two states: off (0) and on (1). Each binary digit is a bit, and 8 bits make a byte.
Binary to decimal
Add the place values where there’s a 1.
Example: 101₂ → 4 + 0 + 1 = 5
Example: 110110₂ → 32 + 16 + 0 + 4 + 2 + 0 = 54
The small 2 shows the base.
Decimal to binary
Method 1: Subtract powers of 2.
Example: 45
- Largest power ≤ 45 is 32 → 45 − 32 = 13 → 1 in the 32s place
- 16 > 13 → 0 in the 16s
- 8 ≤ 13 → 13 − 8 = 5 → 1 in the 8s
- 4 ≤ 5 → 5 − 4 = 1 → 1 in the 4s
- 2 > 1 → 0 in the 2s
- 1 → 1 in the 1s
45 = 101101₂
Method 2: Divide by 2 repeatedly and read the remainders from bottom to top.
| Divide | Quotient | Remainder |
|---|---|---|
| 45 ÷ 2 | 22 | 1 |
| 22 ÷ 2 | 11 | 0 |
| 11 ÷ 2 | 5 | 1 |
| 5 ÷ 2 | 2 | 1 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
Reading up: 101101₂ ✓
Counting in binary
0, 1, 10, 11, 100, 101, 110, 111, 1000, …
Other bases
Hexadecimal (base 16) uses 0–9 and A–F (A = 10, …, F = 15). It’s a compact way to write binary: each hex digit = 4 bits. Web colours like #FF0000 (red) are hexadecimal.
| Decimal | Binary | Hexadecimal |
|---|---|---|
| 10 | 1010 | A |
| 15 | 1111 | F |
| 16 | 10000 | 10 |
| 255 | 11111111 | FF |
Worked examples
Example 1: 101₂ in decimal? 5.
Example 2: 13 in binary? 8 + 4 + 1 → 1101₂.
Example 3: How many values can one byte store? 2⁸ = 256 (0 to 255).
Common mistakes
- Reading binary 101 as "one hundred one". Say "one zero one".
- Putting place values in the wrong order (the ones place is on the right).
- Reading remainders top to bottom in the division method.
Try it yourself
- 1001₂ in decimal
- 11111₂ in decimal
- 20 in binary
- 100 in binary
- Hexadecimal B in decimal
Answers: 1) 9 2) 31 3) 10100₂ 4) 1100100₂ 5) 11
Quick recap
- A number base sets how many digits are used and the place values.
- Binary (base 2) uses 0 and 1; places double: 1, 2, 4, 8, …
- Bits and bytes store all computer data.