What is Hexadecimal?
Hexadecimal (hex) is a base-16 number system. It uses 16 different digits: 0–9 and the letters A–F (where A=10, B=11, C=12, D=13, E=14, F=15). Each hex digit represents exactly one nibble (4 bits), so two hex digits represent one byte (8 bits).
Hexadecimal Digit Values
| Denary | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| Hex | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
| 4-bit binary | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
Binary to Hexadecimal
Split the binary number into groups of 4 bits (nibbles) from the right. Convert each nibble to its hex digit.
Example: Convert 10110111 to hex
- Split: 1011 | 0111
- 1011 = 8+2+1 = 11 = B
- 0111 = 4+2+1 = 7
- Result: B7
Hexadecimal to Binary
Replace each hex digit with its 4-bit binary equivalent.
Example: Convert 4F to binary
- 4 = 0100
- F = 15 = 1111
- Result: 01001111
Hexadecimal to Denary
In hex, place values are powers of 16. The rightmost digit × 1 (16⁰), next × 16 (16¹), next × 256 (16²), etc.
Example: Convert 2C to denary
- 2 × 16 = 32
- C × 1 = 12 × 1 = 12
- Result: 32 + 12 = 44
Why Use Hexadecimal?
- Much shorter than binary — 1 hex digit = 4 bits, so 2 hex digits = 1 full byte
- Easier for humans to read and remember than long binary strings
- Used to represent memory addresses (e.g. 0x3FA1)
- Used for RGB colour codes in web design (e.g. #FF5733)
- Used in error messages and debugging
- Easy to convert to and from binary — no calculation required, just look up the nibble
📝 Exam Tip: When converting binary to hex, always split into groups of 4 from the RIGHT. If the leftmost group has fewer than 4 bits, pad with leading zeros. E.g. 110101 → 0011 | 0101 → 35 in hex.
⚠️ Common Mistakes
- Forgetting the letters A–F — 10 in hex is A, not "10"
- Splitting binary from the left instead of the right when converting to hex
- Thinking hex "10" = denary 10 — it actually equals 16 (1×16 + 0×1)