GCSE Computer Science

An interactive lesson and quiz on Hexadecimal.

Part 1: The Problem with Binary

Computers speak binary, but it's very hard for humans to read.

Imagine trying to read this binary code for a colour:

11100101 10011011 00101111

It's too long! It's easy to make a mistake. We need a shorthand.

Programmers use Hexadecimal (Hex). The same code above in Hex is:

E5 9B 2F

Much easier, right? Today you'll learn how this conversion works.

Part 2: What is Hexadecimal?

Hex is "Base 16". It needs 16 symbols to count.

  • Our Decimal (Base 10) system uses 10 symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
  • Binary (Base 2) uses 2 symbols: 0, 1
  • Hexadecimal (Base 16) uses 16 symbols. We use 0-9, but then "borrow" letters.
Decimal 0-9 10 11 12 13 14 15
Hex 0-9 A B C D E F

Part 3: The "Magic Link"

This is the most important part! Why Hex? Why not Base 10?

The "Magic Link"

Let's look at a 4-bit binary number (a "nibble").

Smallest 4-bit number: 0000 = 0

Biggest 4-bit number: 1111 = (8+4+2+1) = 15

Wait... the range of a 4-bit number (0-15) is the exact same range as one Hex digit (0-F)!

1 Hex Digit = 4 Binary Bits

This is the "magic link". It's why Hex is the perfect shorthand for Binary. (Base 10 doesn't have this link!)

Quiz: Core Concepts (1/7)

1. What is the primary reason for using Hexadecimal?
2. What is the "magic link" between Hex and Binary?
3. A single 4-bit binary number is also known as a...
4. How many symbols are used in the Hexadecimal system?
5. Why is Hex a *better* shorthand for binary than Decimal (Base 10)?
6. An 8-bit number is called a Byte. How many Hex digits are needed to represent one Byte?

Quiz: Hex Digits (2/7)

7. What decimal value does the hex digit 'A' represent?
8. What decimal value does the hex digit 'C' represent?
9. What decimal value does the hex digit 'F' represent?
10. What hex digit represents the decimal value '13'?
11. What hex digit represents the decimal value '9'?
12. What hex digit represents the decimal value '11'?

Quiz: Binary to Hex (3/7)

13. Convert 10000001 to Hex. (Split: 1000 | 0001)
14. Convert 11101001 to Hex. (Split: 1110 | 1001)
15. Convert 00111100 to Hex. (Split: 0011 | 1100)
16. Convert 10101011 to Hex. (Split: 1010 | 1011)

Quiz: Hex to Binary (4/7)

17. Convert 2A to 8-bit binary. (Split: 2 | A)
18. Convert F0 to 8-bit binary. (Split: F | 0)
19. Convert 8B to 8-bit binary. (Split: 8 | B)
20. Convert 44 to 8-bit binary. (Split: 4 | 4)

Quiz: Drag & Drop (5/7)

21. Drag the tokens to convert 10011110 to Hex.
1001|1110

Drag from here:

E 9 F
22. Drag the tokens to convert B4 to 8-bit binary.
B|4

Drag from here:

1011 0100 1100
23. Drag the tokens to match the base to its name.

Drag from here:

Decimal Hexadecimal Binary

Quiz: Debugging (6/7)

24. A student converted 10011100 to 9D. This is wrong. Why?
1001 = 9 (Correct)
1100 = 12 = C (Mistake! They wrote D)

What is the correct Hex value?

25. A student converted F2 to 11110001. This is wrong. Why?
F = 1111 (Correct)
2 = 0010 (Mistake! They wrote 0001)

What is the correct 8-bit binary value?

26. A student converted 00101010 to 25. This is wrong. Why?
0010 = 2 (Correct)
1010 = 10 = A (Mistake! They wrote 5)

What is the correct Hex value?

Quiz: Challenge (7/7)

30. Convert the decimal number 255 to 8-bit binary, then to Hex.
255 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1
31. A 64-bit computer process moves 64 bits of data. How many Hex digits are needed to represent 64 bits?

Lesson Complete!

Well done, Student!

This is your 1st attempt.

Your final score:
0 / 0

Your Personal Feedback: