Number systems and conversions
Why computers use binary
- A computer only has two states: on and off, written 1 and 0.
- A two-digit system is binary (base 2) — and all data must become binary first.
- We use three number systems to work with it.
The three number systems
| System | Base | Digits |
|---|---|---|
| Denary | 10 | 0–9 |
| Binary | 2 | 0 and 1 |
| Hexadecimal | 16 | 0–9 then A–F |
- The base is how many digits a system uses. Hex's A–F stand for 10–15.
- A bit is one 0 or 1; 8 bits = 1 byte; 4 bits = 1 nibble.
Practice
How many bits does one hexadecimal digit represent?
One hex digit covers 16 values = a nibble = 4 bits.
Place value and binary ↔ denary
- In binary the place values double right to left. For 8 bits:
128 64 32 16 8 4 2 1. - Denary → binary: put a 1 under each value you need so they sum to your number. $150 = 128+16+4+2$ →
10010110. - Binary → denary: add the place values where there's a 1.
Practice
Convert binary 10010110 to denary.
128 + 16 + 4 + 2 = 150.
Practice
Convert denary 13 to binary (significant bits only).
13 = 8 + 4 + 1 → 1101.
Hexadecimal and why we use it
- Hex → binary: each hex digit becomes its own nibble (4 bits).
F08→1111 0000 1000. - Binary → hex: group bits into nibbles from the right; each nibble is one hex digit.
- Why hex? it is shorter than binary and easier to read, so fewer mistakes — used for MAC/IPv6 addresses, HTML colours (
#FF0000), and memory addresses.
Practice
Convert hexadecimal 1F to denary.
1 × 16 + 15 = 31 (F is 15).
Practice
Why do computer scientists use hexadecimal?
Hex is just a shorter, human-friendly way to write the same binary value (one digit = 4 bits).
You've got it
Key idea
- binary base 2 (bit · byte = 8 bits · nibble = 4 bits); hex base 16, one digit = 4 bits
- denary → binary: pick the powers of 2 that sum to the number
- binary → hex by grouping nibbles
- hex is a shorter, readable way to write the same binary (addresses, colours)