objectives
By the end you'll be able to…
- Explain what hexadecimal is and why it's used.
- Convert between denary and hexadecimal (both directions).
- Convert between binary and hexadecimal using nibbles.
- Recognise hex in real life — MAC addresses and colour codes.
what is hex?
Hexadecimal — Base-16
Hexadecimal is a number system with 16 digits. Since we only have 10 numerical digits (0–9), the letters A–F are used to represent 10–15.
| Denary | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Hex | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
Each column's place value is a power of 16. At GCSE you'll work with up to 2 hex digits:
| 16s (161) | 1s (160) | = Denary |
|---|---|---|
| 1 | 3 | (1 × 16) + (3 × 1) = 19 |
A single hex digit represents exactly 4 bits (one nibble). Two hex digits represent 8 bits (one byte). This is the trick that makes binary ↔ hex conversion easy.
Flip cards — quick recall
why hex?
Why do we use hexadecimal?
Computers store and process everything in binary — but binary is painful for humans to read and copy.
Hex is a much more compact way to write down the same information:
- Binary numbers are long and hard to read — one wrong 1 or 0 among 32 of them is easy to miss.
- Hex uses fewer digits to represent the same value. 8 bits become 2 hex digits.
- Because one hex digit maps exactly to one nibble, converting binary ↔ hex is fast.
Where you'll see hex in real life
- MAC addresses — the unique address of a network device, e.g.
2C-F0-7C-A7-98 - Colour codes — every colour on a web page is a hex code like
#FF3366 - Memory addresses and error codes in operating systems.
denary → hex
Converting denary to hexadecimal
Method 1 — via binary (recommended)
Because 1 hex digit = 4 bits, you can go denary → binary → hex:
- Convert the denary number to 8-bit binary.
- Split into two nibbles (4 bits each).
- Convert each nibble to its denary value (0–15).
- Use the hex table to write A–F for values 10–15.
28 in binary = 00011100. Split into nibbles: 0001 | 1100.
0001 = 1 → hex digit 1. 1100 = 12 → hex digit C.
28 = 1C in hex ✅
Method 2 — divide by 16
Divide the denary number by 16. The whole number is the first hex digit, the remainder is the second.
163 ÷ 16 = 10 remainder 3. So digit 1 = 10 (A), digit 2 = 3.
163 = A3 in hex ✅
The exam is non-calculator. If dividing by 16 in your head is hard, use Method 1 — most students find it more reliable.
hex → denary
Converting hexadecimal to denary
Method 1 — via binary
Reverse of before: convert each hex digit to a 4-bit binary nibble, join them, then convert the 8-bit number to denary.
B = 11 = 1011. 9 = 1001. Joined: 10111001.
Read the place values: 128 + 32 + 16 + 8 + 1 = 185 ✅
Method 2 — multiply by 16
Multiply the first digit by 16, then add the second digit.
7 × 16 = 112. Add 9: 112 + 9 = 121 ✅
🖱️ Try it — hex → denary + binary
binary ↔ hex
Converting binary ↔ hexadecimal directly
Because 1 hex digit = 4 bits, direct conversion is quick.
Binary → Hex
- Split the 8-bit binary into two nibbles.
- Convert each nibble to its denary value (0–15).
- Write the hex digit (A–F for 10–15).
Split: 1011 | 0111.
1011 = 8 + 2 + 1 = 11 = B. 0111 = 4 + 2 + 1 = 7.
10110111 = B7 in hex ✅
Hex → Binary
- Split the two hex digits.
- Convert each to a 4-bit binary nibble.
- Join the nibbles to make an 8-bit binary number.
5 = 0101. F = 15 = 1111.
5F = 01011111 in binary ✅
| Denary | Binary | Hex |
|---|---|---|
| 0 | 0000 | 0 |
| 1 | 0001 | 1 |
| 2 | 0010 | 2 |
| 3 | 0011 | 3 |
| 4 | 0100 | 4 |
| 5 | 0101 | 5 |
| 6 | 0110 | 6 |
| 7 | 0111 | 7 |
| 8 | 1000 | 8 |
| 9 | 1001 | 9 |
| 10 | 1010 | A |
| 11 | 1011 | B |
| 12 | 1100 | C |
| 13 | 1101 | D |
| 14 | 1110 | E |
| 15 | 1111 | F |
The most common mistake is muddling A–F with 10–15. Write the 16-row table out first thing in the exam and you'll never mix them up.
colours
Hex in the wild — colour codes
Every colour on a web page can be written as a 6-digit hex code: two digits each for red, green and blue (0–255 per channel).
Try changing the values above. Every colour on this page uses a hex code just like this one.
practice
Exam-style practice
Q1. Convert denary 90 to hexadecimal.
Q2. Convert hex 2D to denary.
Q3. Convert binary 11101010 to hex.
Q4. Give two reasons why programmers prefer hex over binary.
// end of topic 3 — hexadecimal