Bytesize CS

Hexadecimal

Practise converting between hexadecimal (base 16), binary and denary. Choose a conversion, then a size.

Score 0 / 0 Streak 0 Best 0

Hex digits table
How to convert hexadecimal

Hexadecimal uses 16 digits: 0–9, then A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15. One hex digit is exactly one nibble (4 bits), so two hex digits make a byte.

Hex → binary: convert each hex digit into a 4-bit nibble using the place values 8, 4, 2, 1. Example: B7 → B = 11 = 1011, 7 = 0111, so 1011 0111.

Binary → hex: split the binary into nibbles from the right, convert each nibble to denary, then to a hex digit. Example: 1011 0111 → 1011 = 11 = B, 0111 = 7, so B7.

Hex → denary: the left digit is worth 16s and the right digit is worth 1s. Example: B7 = 11 × 16 + 7 × 1 = 176 + 7 = 183.

Denary → hex: divide by 16. The answer is the left digit and the remainder is the right digit. Example: 183 ÷ 16 = 11 remainder 7, and 11 = B, so B7.

Going via binary: you can also convert between hex and denary in two steps, using binary in the middle. For hex → denary, turn each hex digit into a nibble, then add up the place values 128, 64, 32, 16, 8, 4, 2, 1. For denary → hex, turn the denary into binary, then convert each nibble into a hex digit. Switch on Go via binary to practise this way.