🔢 Chapter 1 · Topic 8 · Paper 1 & 2

Denary to Hexadecimal

Converting whole numbers to their hex equivalents — step by step, remainder by remainder

🔥 01 · Did You Know?

When a graphics card renders a pixel with a red value of 220, it needs to store that as hex to pack it into a colour code. When a router assigns a MAC address, it converts hardware IDs to hex. When a web developer reads a debug log, every memory address they see was converted from a raw denary integer — automatically, thousands of times per second. The conversion you're learning today is the exact algorithm every programming language uses internally when you call a function like hex(220) or toString(16). It is also one of the most reliably tested Cambridge Paper 1 skills — appearing in virtually every past paper under Data Representation.

Converting Denary to Hexadecimal

The method mirrors converting denary to binary — but instead of dividing by 2, you divide by 16. Each remainder becomes one hex digit. Because 16² = 256, any value from 0 to 255 (one byte) can always be expressed in exactly two hex digits.

🔑 The method: divide by 16, record the remainder as a hex digit. Divide the quotient again. Read remainders bottom to top — last remainder is the most significant (left) digit.
★ Exam Method
Division by 16
Divide by 16, record the remainder as a hex digit. Repeat until the quotient is 0. Read remainders bottom to top.
works for any denary number
Shortcut
Via Binary Nibbles
Convert denary → 8-bit binary first, then split into two nibbles of 4 bits and read each nibble as a hex digit.
useful if you already have binary

The Division-by-16 Method — Step by Step

1

Divide your denary number by 16. Record the remainder (0–15). If the remainder is 10–15, convert it to the hex letter A–F.

2

Take the quotient and divide by 16 again. Record the remainder. Repeat until the quotient becomes 0.

3

Read the remainders bottom to top. The last remainder is the most significant hex digit (written first, on the left).

4

For values 0–255, pad to two hex digits with a leading 0 if needed (e.g. denary 7 → hex 07, not just 7).

Worked Illustration — 220 to Hex

Division working:
220
÷ 16 =
13
r
12
C
← LSB (low digit)
13
÷ 16 =
0
r
13
D
← MSB (high digit)

Read bottom to top: DC. Verify: (D × 16) + (C × 1) = (13 × 16) + 12 = 208 + 12 = 220 ✓

Remainders 10–15 → Letters A–F

This is where students most often lose marks. Any remainder of 10 or above must be converted to its hex letter before writing:

Remainder 10 → A Remainder 13 → D Remainder 11 → B Remainder 14 → E Remainder 12 → C Remainder 15 → F

⚠️ Common Exam Mistakes

Writing the remainder as denary — if your remainder is 13, write D, not 13. Writing "13" as a hex digit is wrong and loses the mark.

Reading remainders top to bottom — always bottom to top. The first remainder you calculate is the units (low) hex digit, not the high digit.

Forgetting to pad to two digits — if your number is less than 16, the answer is 0X (e.g. denary 9 → hex 09). A single digit answer will lose the mark if two are expected.

Not verifying — always check by converting back: multiply each hex digit by its place value (×16 and ×1) and add. If it doesn't match your original number, an error was made.

🏆
Cambridge Exam Tip: Show the full division table — number, ÷16, quotient, remainder, and the hex equivalent of that remainder. Examiners award method marks even if the final answer is wrong. A 2-mark denary→hex question typically awards [1] for correct method and [1] for correct final two-digit hex answer.
Denary → Hex Converter
// Enter any denary value 0–255 · See every division step · Watch the hex digits assemble
Quick examples:
255
220
183
160
127
75
16
9
⚠ Enter a whole number between 0 and 255.
Number ÷ 16 = Quotient Remainder Hex digit
Reading remainders bottom to top → hex result:

Converting 199 to Hexadecimal

This example produces a remainder of 7 and a quotient remainder of 12 — testing both a number digit and a letter digit.

📋 Question: A pixel has a green channel value of 199. Express this as a two-digit hexadecimal number. Show your division working clearly. [2]
1
➗ First division
Divide 199 by 16. What is the quotient and remainder?
▶ Click to reveal
199 ÷ 16 = 12 remainder 7 Quotient = 12 Remainder = 7 → hex digit: 7 (units / low digit) 7 is less than 10, so no letter conversion needed.
2
➗ Second division
Divide the quotient (12) by 16. What is the next remainder?
▶ Click to reveal
12 ÷ 16 = 0 remainder 12 Quotient = 0 → stop dividing Remainder = 12 → hex digit: C (16s / high digit) 12 ≥ 10, so convert: 12 = C in hexadecimal.
3
📖 Assemble and verify
Read remainders bottom to top. Then verify by converting back to denary.
▶ Click to reveal
Remainders (bottom to top): C, 7 Hexadecimal result = C7 Verification: (C × 16) + (7 × 1) = (12 × 16) + 7 = 192 + 7 = 199 ✓ [2 marks: division method shown ✓ | correct answer C7 ✓]

Cambridge-Style Practice

Show the full division table. Always verify your answer by converting back.

Question 1
2 marks
Convert the denary number 158 to hexadecimal. Show your working.
Division working: 158÷16=9 remainder 14 → E; then 9÷16=0 remainder 9 → 9[1]
Correct hex result: 9E  (verify: 9×16+14 = 144+14 = 158 ✓)[1]
Question 2
2 marks
A sound sample is stored with the amplitude value 243. Express this in hexadecimal. Show working.
243÷16=15 remainder 3 → digit: 3; 15÷16=0 remainder 15 → digit: F[1]
Hex result: F3  (verify: 15×16+3 = 240+3 = 243 ✓)[1]
Question 3
3 marks
A student converts denary 173 to hex and writes the answer as DA. Show the correct working, state the correct answer, and explain what error the student made.
Correct working: 173÷16=10 r13; 10÷16=0 r10[1]
Correct answer: AD  (verify: 10×16+13=160+13=173 ✓). The student's answer DA = 218 ≠ 173.[1]
The student read the remainders top to bottom instead of bottom to top — the first remainder (13=D) is the low/units digit, and the second (10=A) is the high digit. The correct order is A then D → AD.[1]
Question 4
1 mark
Convert the denary number 11 to a two-digit hexadecimal number.
0B — 11÷16=0 remainder 11=B. Pad with leading zero to make two digits. Accept B only if question does not specify two digits.[1]

5-Question Challenge

Division steps, remainder-to-letter conversions, and common error traps. Complete all 5 to save your progress!

Score:
0 / 5
🟠
Topic 8 Complete — Hex Converter Certified!
+50 XP · Chapter 1 · Data Representation
🏆
Lesson Complete! Score: · Saved ✅
Next Lesson →