Learning Objectives
  • Interpret hexadecimal digits A to F as denary values 10 to 15.
  • Convert positive integers between denary and hexadecimal.
  • Convert directly between hexadecimal and binary using four-bit groups.
  • Explain why hexadecimal is a beneficial representation of binary.
  • Identify appropriate uses of hexadecimal in computer science.
Key Terms
Hexadecimal digit
One base 16 symbol: 0-9 or A-F.
Hex digit
A shorter name for a hexadecimal digit.
Nybble or nibble
A group of four bits; one hexadecimal digit represents exactly four bits.
Memory address
A numeric location used to identify a place in memory.
Colour code
A value representing colour components, often written in hexadecimal.
Summary diagram for 1.3 Hexadecimal Conversions And Uses
Summary Of The Main Ideas In This Lesson
The Hexadecimal Digit Set

Hexadecimal is base 16, so it needs sixteen different digit symbols. The symbols 0 to 9 keep their usual values. The letters A, B, C, D, E and F represent denary 10, 11, 12, 13, 14 and 15.

Each position has a place value that is a power of 16. From right to left, the first four place values are 1, 16, 256 and 4096. For example, hexadecimal 2A has value 2 x 16 + 10 = 42.

Letters in hexadecimal are digits, not variables. Uppercase and lowercase letters usually represent the same values, but examination answers are clearer when A-F are written in uppercase.

Hexadecimal To Denary And Back

To convert hexadecimal to denary, multiply every hexadecimal digit value by its place value and add the products. Replace A-F with 10-15 before calculating.

To convert denary to hexadecimal, repeatedly divide by 16 and record the remainder. Remainders 10-15 must be written as A-F. Read the remainders in reverse order. For small values, the descending-place-value method can also be used.

As with binary conversion, a reverse conversion provides a useful check.

Direct Conversion Between Binary And Hexadecimal

One hexadecimal digit represents exactly four binary bits because both systems are based on powers of two: 16 equals 2^4. This creates a direct mapping between the sixteen possible four-bit patterns and the sixteen hexadecimal digits.

To convert binary to hexadecimal, split the binary number into groups of four bits starting at the right. Add leading zeros to the leftmost group if necessary. Convert each four-bit group independently.

To convert hexadecimal to binary, replace each hexadecimal digit with exactly four bits. Keep leading zeros inside every group so that the groups remain aligned. Leading zeros may be removed only from the far left of the complete answer if a fixed length is not required.

Why Hexadecimal Is Useful

Long binary patterns are difficult for people to read, copy and compare. Hexadecimal expresses the same pattern using one quarter as many symbols. This makes values shorter and reduces the chance of human transcription errors while preserving an exact relationship with the underlying binary.

Hexadecimal is used where people need to inspect or enter binary-related values. Examples include memory addresses, machine-code and debugging displays, Media Access Control addresses, Internet Protocol version 6 addresses and colour codes. The computer still stores and processes binary; hexadecimal is mainly a convenient human-readable notation.

A strong explanation gives both parts: hexadecimal is shorter and easier for humans, and each hex digit maps exactly to four bits so conversion is straightforward.

Four-Bit To Hexadecimal Mapping
Binary Hex Denary Binary Hex Denary
0000 0 0 1000 8 8
0001 1 1 1001 9 9
0010 2 2 1010 A 10
0011 3 3 1011 B 11
0100 4 4 1100 C 12
0101 5 5 1101 D 13
0110 6 6 1110 E 14
0111 7 7 1111 F 15
Common Uses Of Hexadecimal
Use Why Hexadecimal Helps
Memory addresses Long binary addresses become shorter and easier to inspect.
Debugging and machine-code displays Bit patterns can be read and copied more reliably.
HTML/CSS colour values Three colour components can be represented compactly, such as FF0000.
MAC addresses Hardware address bytes can be displayed as pairs of hex digits.
IPv6 addresses Very long 128-bit addresses are written more compactly.
Worked Examples
Hexadecimal To Denary

Question: Convert 3B7 to denary.

  1. 3 x 256 = 768.
  2. B represents 11, so 11 x 16 = 176.
  3. 7 x 1 = 7.
  4. Add: 768 + 176 + 7 = 951.

Answer: 3B7 is denary 951.

Denary To Hexadecimal

Question: Convert denary 684 to hexadecimal.

  1. 684 / 16 = 42 remainder 12, which is C.
  2. 42 / 16 = 2 remainder 10, which is A.
  3. 2 / 16 = 0 remainder 2.
  4. Read from bottom to top.

Answer: 684 is hexadecimal 2AC.

Binary To Hexadecimal

Question: Convert 110101101011 to hexadecimal.

  1. Group from the right: 1101 0110 1011.
  2. 1101 = D, 0110 = 6, 1011 = B.

Answer: The hexadecimal value is D6B.

Hexadecimal To Binary

Question: Convert 7E4 to binary.

  1. 7 = 0111.
  2. E = 1110.
  3. 4 = 0100.
  4. Join the groups.

Answer: 7E4 is 011111100100.

Examination Guidance
  • Memorise or reconstruct the complete 0000-to-1111 mapping.
  • Group binary digits from the right, not from the left.
  • Write four bits for every hexadecimal digit during hex-to-binary conversion.
  • When explaining usefulness, mention shorter representation and easier human reading, not faster computer processing.
Common Mistakes
  • Treating A-F as place values rather than digit values 10-15.
  • Forgetting that hexadecimal 10 is denary 16, not denary 10.
  • Grouping binary from the wrong end.
  • Saying computers process hexadecimal directly. The underlying representation remains binary.
Knowledge Check

1. Convert hexadecimal 9F to denary.

Answer: 159.

2. Convert denary 255 to hexadecimal.

Answer: FF.

3. Convert binary 101011110010 to hexadecimal.

Answer: AF2.

4. Convert hexadecimal C3A to binary.

Answer: 110000111010.

5. Why is hexadecimal less prone to transcription error than binary?

Answer: The same value is written with fewer symbols, so it is easier for people to read and copy accurately.