Hexadecimal (hex) has sixteen digits, 0 to 9 then A to F (10 to 15). One hex digit is exactly four bits, so a byte is always two hex digits: 1010 0011 is A3. It's a short way to write binary, used for web colours, memory addresses and error codes. Like binary, it's a public rule, not a secret.
Web colours look like #FF8800 and error codes like 0x1F. Why do programmers write numbers with letters in them?
What you should already know:
Bits and binary numbers· A computer stores numbers with switches that are only off (0) or on (1).
How many patterns?· Each extra bit doubles the number of patterns: n bits make 2ⁿ patterns.
Binary needs a lot of digits: 255 is 11111111. Programmers write it shorter, in a way that still shows the bits.
How this lesson works: Predict, Try, Investigate, Modify, Practise, Make
Predict: Read the problem and decide what you think before you try anything. A wrong guess is fine: it shows you what to look for.
Try: Try it on the board and compare the result with your prediction.
Investigate: Work out why it happens, one step at a time.
Modify: Change the problem on purpose and see what happens.
Practise: A few on your own, to check you have it.
Make: Make your own problem using what you have learned. Expect a few tries; that is normal.
Make your prediction first. Help opens once you've locked it in.
PredictRead the problem and decide what you think before you try anything. A wrong guess is fine: it shows you what to look for.
What is FF?
TryTry it on the board and compare the result with your prediction.
Try: every card up
Was your prediction right? Now flip the left-hand group down. What's left?
Try it yourselfYour edits are saved in this browser.
Turn every card face up. What does the hex under each group of four say?
Use the board. This ticks when you get there.
InvestigateWork out why it happens, one step at a time.
Worked example: four bits, one digit
Worked exampleBefore each step, say what you think comes next.
0–9,A–FSixteen digits: A is 10, B 11, C 12, D 13, E 14, F 15.
0000 to 1111Four bits make 16 patterns, 0 to 15: exactly one hex digit.
10100011→A3Split a byte into two groups of four and write each as one digit: A3.
A3=10×16+3=163The left digit counts sixteens, the right digit ones.
why bother?Two hex digits always make one byte, so hex is binary made short, and you can still see the bits.
Now read hex B.
Hex digits go 0 to 9, then A, B, C, D, E, F for 10 to 15. What number is hex B?
Sam reads a hex number. Click the line where it first goes wrong.
ModifyChange the problem on purpose and see what happens.
Vary: make the hex
Try it yourselfYour edits are saved in this browser.
Make the hex read 0F.
Use the board. This ticks when you get there.
Now make it read 80.
Use the board. This ticks when you get there.
Make it read A3.
Use the board. This ticks when you get there.
PractiseA few on your own, to check you have it.
Hex in the wild
In #FF8800, red is FF, green is 88 and blue is 00. What number is the green, 88?
Review: what number is the binary 1011?
MakeMake your own problem using what you have learned. Expect a few tries; that is normal.
The badge colour
Then: write your favourite colour as three numbers from 0 to 255, then as hex.
Try it yourselfYour edits are saved in this browser.
Students group binary cards in fours to read and write hex, see that one hex digit is exactly four bits and a byte is two hex digits, read web colours, and meet hex as a public rule (AC9TDI8K04 node 1, binary representation of integers, written short). Optional; Encoding is not encryption (Capture the flag) decodes hex and is the natural place to point students who skipped it. About 35 minutes.
I can turn four bits into one hex digit, and back.
I can write a byte as two hex digits.
I can read a web colour like
Before class
Do the boards yourself first. Students need Bits and binary numbers and How many patterns? (four bits make 16 patterns).
The one idea: four bits make exactly 16 patterns, so one hex digit stands for four bits, and two hex digits for a byte. Hex is binary written short, not a new kind of number.
Added 25 Oct 2026 to answer the roadmap's open question (hex in the colour lesson, or Years 9–10?): an optional lesson after How many patterns, with one line in Colour and images. It is optional because the descriptor doesn't name hex. Encoding is not encryption (Capture the flag) uses hex but doesn't list it in assumes:, since an optional lesson can't satisfy that check.
Running the lesson
Predict: students who chose 1515 read each F as 15 and joined them; ask how many cards each F stands for.
Try: ask how many hex digits a byte needs, and why never three.
Worked example: ask what the left digit counts.
Make: let students work out 200 on paper first, then check with the cards.
The hard part (on purpose)
Joining the two digits like decimal (1F as 115). Every time, ask what the left digit counts: sixteens.
When students get stuck
A student reads 1F as 115 (Sam's mistake). Ask: What does the left digit count? Fix: Sixteens: 1 × 16 + 15 = 31.
A student thinks B is 2. Ask: Which hex digit comes after 9? Fix: A is 10, so B is 11.
Stretch and support
Stretch: Memory addresses are often written in hex, like 0x7FFF. How many bits does each hex digit stand for, so how many bits is that address?
Support: A card: 0–9 as usual, A 10, B 11, C 12, D 13, E 14, F 15. One hex digit = four bits; two = a byte.
Where it leads
Next: Why binary: logic gates.
Links: Colour and images (RGB values), Capture the flag › Encoding is not encryption (hex as a public rule).
What each step is for
what is FF?: Committing to a value for FF tests the new move: two hex digits stand for two groups of four bits.
Try: every card up: Turning all eight cards up settles the prediction: each group of four shows F, and the number is 255.
Worked example: four bits, one digit: Reading groups of four as single digits, then a byte as two digits, models the new move. Sam joins the digits like decimal, the misconception planted after the method.
Vary: make the hex: Each task gives a hex number and students set the bits: one group at a time, then both.
hex in the wild: Reading a web colour, counting hex digits for a byte, hex as a public rule (the CTF's first idea), and a review of binary.
the badge colour: Going from a decimal number to hex reverses the process: students find the sixteens and the ones, then set the bits.