Why Hexadecimal?

Binary is the language computers speak, but binary numbers get very long very quickly. The number 255 in binary is 11111111 — eight digits just for a relatively small number. Imagine trying to read, type, or debug a 32-bit memory address written entirely in 0s and 1s. You would almost certainly make a mistake.

This is where hexadecimal (hex for short) comes in. Hexadecimal is a base-16 number system. It uses 16 digits:

LetterABCDEF
Value101112131415

The magic of hex is that one hex digit represents exactly 4 binary bits (a nibble). This means you can convert between hex and binary very quickly, without doing any arithmetic. Two hex digits represent a full byte (8 bits), and the longest numbers become short and manageable.

Key Concept: Why Hex Exists Hexadecimal is not a different type of data — it is simply a more compact way for humans to read and write binary values. Computers still work in binary internally. Hex is a convenience for programmers, not for machines.

Where is hex used in real life?

The Hex-Binary-Denary Connection

The table below is the foundation of all hex work. It shows every possible value for a single hex digit alongside its binary and denary equivalents. You do not need to memorise the entire table for the exam, but you should be very comfortable looking up or working out any row.

DenaryBinary (4-bit)Hex
000000
100011
200102
300113
401004
501015
601106
701117
810008
910019
101010A
111011B
121100C
131101D
141110E
151111F

Converting Hex to Binary

This is the easiest conversion of all. Simply replace each hex digit with its 4-bit binary equivalent. That is it — no arithmetic required.

Example 1: Convert hex A7 to binary.

Hex to Binary — A7
  A    7
  |    |
 1010  0111

  A7 in binary = 10100111

A = 1010, 7 = 0111. Join them together: 10100111.

Example 2: Convert hex 2F to binary.

Hex to Binary — 2F
  2    F
  |    |
 0010  1111

  2F in binary = 00101111

2 = 0010, F = 1111. Join them together: 00101111.

Converting Binary to Hex

This is the reverse of the method above. Split the binary number into groups of 4 bits (nibbles), starting from the right, and convert each nibble to its hex digit.

Example 1: Convert binary 10110011 to hex.

Binary to Hex — 10110011
  1011  0011
   |     |
   B     3

  10110011 in hex = B3

Split: 1011 = B, 0011 = 3. Answer: B3.

Example 2: Convert binary 11101010 to hex.

Binary to Hex — 11101010
  1110  1010
   |     |
   E     A

  11101010 in hex = EA

Split: 1110 = E, 1010 = A. Answer: EA.

Converting Hex to Denary

Each hex digit has a place value, just like in denary and binary. For a two-digit hex number, the left digit is in the 16s column and the right digit is in the 1s column. Multiply each digit by its place value and add the results.

Example 1: Convert hex 2F to denary.

Hex to Denary — 2F
  Place values:   16    1

  Hex digits:      2    F (F = 15)

  Calculation:   (2 × 16) + (15 × 1)
               =    32    +    15
               =    47

  2F in denary = 47

Example 2: Convert hex B8 to denary.

Hex to Denary — B8
  Place values:   16    1

  Hex digits:      B    8 (B = 11)

  Calculation:   (11 × 16) + (8 × 1)
               =    176    +    8
               =    184

  B8 in denary = 184

Converting Denary to Hex

To convert denary to hex, divide by 16. The quotient (whole number part) becomes the first hex digit, and the remainder becomes the second hex digit.

Example: Convert denary 94 to hex.

Denary to Hex — 94
  94 ÷ 16 = 5 remainder 14

  Quotient:   5  → hex digit 5
  Remainder: 14  → hex digit E

  94 in hex = 5E

Check: 5 × 16 + 14 = 80 + 14 = 94. Correct!

Quick Conversions to Try:
  1. Convert hex C4 to binary. (C = 1100, 4 = 0100, so C4 = 11000100)
  2. Convert binary 11110001 to hex. (1111 = F, 0001 = 1, so 11110001 = F1)
  3. Convert hex 5E to denary. (5 × 16 + 14 = 80 + 14 = 94)
  4. Convert denary 200 to hex. (200 ÷ 16 = 12 remainder 8, so 200 = C8)
  5. Convert hex 3A to binary, then to denary. (3A = 00111010 = 58)

Hex in the Real World

Hex Colour Codes in Web Design

One of the most visible uses of hexadecimal is in web design. In HTML and CSS, colours are defined using a # symbol followed by six hex digits in the format #RRGGBB:

Each pair ranges from 00 (none of that colour, which is 0 in denary) to FF (maximum of that colour, which is 255 in denary). By mixing different amounts of red, green, and blue, you can create over 16.7 million different colours (256 × 256 × 256 = 16,777,216).

Hex CodeRedGreenBlueColour
#FF0000FF (255)00 (0)00 (0) Pure Red
#00FF0000 (0)FF (255)00 (0) Pure Green
#0000FF00 (0)00 (0)FF (255) Pure Blue
#FFFFFFFF (255)FF (255)FF (255) White
#00000000 (0)00 (0)00 (0) Black
#FF5733FF (255)57 (87)33 (51) Warm Orange

Notice how hex makes colour codes compact and easy to read. Writing the same information in binary would mean 24 binary digits for every single colour — far too long to work with practically.

Hex Memory Addresses

Every byte stored in a computer’s RAM has a unique memory address. These addresses are written in hexadecimal because hex is far more compact and readable than binary.

Consider this comparison:

Memory Address Comparison
  Hex:      0x7FFF5A2C            (8 digits)
  Binary:   01111111111111110101101000101100  (32 digits!)
  Denary:   2147465772            (10 digits)

The hex version is short, easy to read, and trivially converts to binary when needed. This is why programmers, debuggers, and operating systems all display memory addresses in hex. When you see addresses like 0x0040A000 or 0xDEADBEEF, the 0x prefix tells you the number is hexadecimal.

MAC Addresses

Every network device (your laptop’s Wi-Fi card, your phone’s Bluetooth chip, your router) has a unique identifier called a MAC address (Media Access Control). MAC addresses are written as six pairs of hex digits separated by colons or hyphens:

MAC Address Format
  AA:BB:CC:DD:EE:FF

  Each pair = 1 byte (8 bits)
  6 pairs = 6 bytes = 48 bits total

  In binary, the same address would be:
  10101010:10111011:11001100:11011101:11101110:11111111

The hex format is clearly much easier for network engineers to read, copy, and troubleshoot. The first three pairs typically identify the manufacturer (e.g. Apple, Samsung, Intel), and the last three pairs are unique to the individual device.

Did You Know? Hexadecimal turns up in some surprising places in everyday life. The “blue screen of death” on Windows displays error codes in hex (like 0x0000007E). Many software licence keys use hex digits. Even some playful programmers use hex to write words — 0xDEADBEEF, 0xCAFEBABE, and 0xBAADF00D are all famous hex values used as debugging markers in real software! Java class files, for example, always begin with the “magic number” 0xCAFEBABE.

Interactive Exercises

Exercise 1: Hex to Binary Converter

Convert the following hexadecimal value to its 8-bit binary equivalent.

A7
Score: 0 / 0

Exercise 2: Hex to Denary Converter

Convert the following hexadecimal value to its denary (decimal) equivalent.

2F
Score: 0 / 0

Exercise 3: Hex Colour Mixer

Enter hex values (00 to FF) for each colour channel and watch the colour update in real time. Experiment to discover how red, green, and blue combine!

#FF5733
Hex: #FF5733  |  Denary: R=255, G=87, B=51
Challenges to Try:
  1. Can you make pure yellow? (Hint: yellow = red + green, no blue)
  2. Can you make a nice sky blue?
  3. What happens when all three channels have the same value?
  4. Try making your school’s uniform colour!

Test Yourself

Click on each question to reveal the answer. Try to work it out yourself first!

Q1: Convert hex 3D to binary.

Answer: 3 = 0011, D = 1101. Join them: 00111101.

Q2: Convert binary 01011110 to hex.

Answer: Split into nibbles: 0101 = 5, 1110 = E. Answer: 5E.

Q3: Convert hex 9C to denary.

Answer: 9 × 16 + 12 × 1 = 144 + 12 = 156.

Q4: Convert denary 171 to hex.

Answer: 171 ÷ 16 = 10 remainder 11. 10 = A, 11 = B. Answer: AB. Check: 10 × 16 + 11 = 160 + 11 = 171. Correct!

Q5: A website uses the colour code #2E86C1. Break this down into its RGB components in denary.

Answer:
Red: 2E = 2 × 16 + 14 = 32 + 14 = 46
Green: 86 = 8 × 16 + 6 = 128 + 6 = 134
Blue: C1 = 12 × 16 + 1 = 192 + 1 = 193
This is a medium blue colour with low red, moderate green, and high blue.

Q6: Why is hexadecimal used instead of binary for memory addresses?

Answer: Hexadecimal is used because it is much more compact and readable than binary. A 32-bit binary memory address would be 32 digits long, but the same address in hex is only 8 digits. Hex also converts easily to and from binary (each hex digit = 4 bits), so programmers can quickly switch between the two systems when needed. This reduces the chance of errors when reading or typing addresses.

Q7: Convert the hex value FF to binary and then to denary. What is significant about this number?

Answer:
To binary: F = 1111, F = 1111. FF = 11111111.
To denary: 15 × 16 + 15 = 240 + 15 = 255.
Significance: 255 is the largest value that can be stored in a single byte (8 bits). This is why colour channels in hex colour codes range from 00 to FF — each channel is exactly one byte. It is also the maximum value for many settings in computing, such as subnet masks in networking (255.255.255.0).

Key Vocabulary

Make sure you know all of these terms for your exam:

TermDefinition
HexadecimalA base-16 number system using digits 0–9 and letters A–F. Used as a compact, human-friendly shorthand for binary.
NibbleA group of 4 bits (half a byte). One nibble can represent exactly one hexadecimal digit, with values from 0 to F (0–15 in denary).
Hex Colour CodeA six-digit hexadecimal value preceded by # (e.g. #FF5733) used in web design to define colours. The six digits represent Red, Green, and Blue components in pairs.
Memory AddressA unique identifier for a specific location in a computer’s RAM. Typically written in hexadecimal with a 0x prefix for readability.
MAC AddressMedia Access Control address — a unique 48-bit identifier assigned to every network interface, written as six pairs of hex digits (e.g. AA:BB:CC:DD:EE:FF).
RGBRed, Green, Blue — the colour model used in screens and digital displays. Each component is stored as a value from 0 to 255 (00 to FF in hex).

Exam Tips

Exam Tip 1: The Nibble Trick The fastest way to convert between hex and binary is the nibble method. Each hex digit maps to exactly 4 bits. For hex-to-binary, replace each digit with its 4-bit pattern. For binary-to-hex, split the binary into groups of 4 from the right, then convert each group. This is much quicker than going via denary, and examiners love to see it used correctly.
Exam Tip 2: Hex Place Values For a two-digit hex number, the place values are 16 and 1. Multiply each digit by its place value and add. For example, hex 3A = (3 × 16) + (10 × 1) = 48 + 10 = 58. If you see a three-digit hex number in a harder question, the place values are 256, 16, 1 (powers of 16: 162, 161, 160).
Exam Tip 3: Common Mistakes to Avoid
  • Forgetting that A–F represent 10–15. If a question asks you to convert hex B to denary, the answer is 11, not “B.”
  • Not padding to 4 bits. When converting hex 3 to binary, write 0011, not just 11. You need all four bits for each nibble.
  • Mixing up the direction. Read the question carefully — “hex to binary” and “binary to hex” require opposite steps.
  • Forgetting to show working. Always write out the nibble breakdown or place value calculation. Method marks are available even if the final answer is wrong.
Exam Tip 4: Explaining Why Hex Is Used A common exam question is: “Explain why hexadecimal is used instead of binary.” A strong answer includes three points: (1) Hex is more compact — fewer digits to represent the same value. (2) Hex is easier for humans to read and remember, reducing the chance of errors. (3) Hex converts to and from binary easily and quickly because each hex digit represents exactly 4 bits.

Past Paper Questions

Try these exam-style questions, then click to reveal the mark scheme answer.

Convert the denary number 200 to hexadecimal. Show your working. [2] marks

Mark scheme:

  • 200 ÷ 16 = 12 remainder 8 (1)
  • Answer: C8 (1)
Convert the hexadecimal number 3F to denary. [2] marks

Mark scheme:

  • 3 × 16 = 48, F (15) × 1 = 15 (1)
  • Answer: 63 (1)
Give two reasons why hexadecimal is used in computing instead of binary. [2] marks

Mark scheme:

  • Hexadecimal is shorter / easier for humans to read and write than long binary strings (1)
  • Each hex digit represents exactly 4 binary digits, making conversion between hex and binary straightforward (1)

Why Hex Matters

Hexadecimal is one of those topics that might seem abstract at first, but once you start noticing it, you see it everywhere:

The key takeaway is that hex is not a separate number system that computers use — computers always use binary. Hexadecimal is a tool for humans, a shorthand that makes binary manageable. Learning to convert fluently between hex, binary, and denary is an essential skill that will come up in your exam and serve you well if you continue into programming, networking, or cyber security.

Video Resources

Further Reading