Binary is how the machine thinks, but for humans it is a nightmare to read: 11111010 is easy to miscopy. So programmers use a shorthand called hexadecimal (base 16) that packs four binary digits into a single symbol. That long byte becomes just FA — two characters instead of eight.
Sixteen digits
Base 16 needs sixteen single symbols. We reuse 0–9 and then borrow the first six letters for ten to fifteen. Think of A–F simply as "the teens' single-character names".
| Denary | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Binary | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 |
| Hex | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
Binary ↔ hex — the easy direction
A group of four bits is a nibble, and one nibble is exactly one hex digit. So to convert binary to hex, split into nibbles from the right and translate each using the table. To go back, expand each hex digit into its four bits.
Split into nibbles: 1011 and 0111. From the table 1011 = B and 0111 = 7. So the byte is B7.
Hex ↔ denary
A two-digit hex number has a 16s column and a 1s column. Multiply the left digit by 16, add the right digit. To go the other way, divide by 16: the quotient is the left digit and the remainder is the right.
D = 13. So 2D = (2 × 16) + 13 = 32 + 13 = 45.
And back: convert denary 200 to hex. 200 ÷ 16 = 12 remainder 8. 12 = C, remainder 8. So 200 = C8. Check: (12 × 16) + 8 = 200. ✓
Tip: the quickest route between denary and hex is often via binary. Turn the denary into 8-bit binary, split into two nibbles, and read off two hex digits — no division needed.