Base 16, nibbles and MAC addresses
Hexadecimal Explained: Hex to Decimal and Binary
Hexadecimal (hex) is a compact way to write binary. Every hex digit is exactly four bits, so a byte is always two hex digits. You will see it in MAC addresses, IPv6 addresses and colour codes.
What is hex?
Hexadecimal is base 16. After 0–9 it uses A–F for 10–15. One hex digit is exactly four bits (a nibble), so a byte is always two hex digits.
| Hex | Decimal | Binary |
|---|---|---|
| 0 | 0 | 0000 |
| 1 | 1 | 0001 |
| 2 | 2 | 0010 |
| 3 | 3 | 0011 |
| 4 | 4 | 0100 |
| 5 | 5 | 0101 |
| 6 | 6 | 0110 |
| 7 | 7 | 0111 |
| 8 | 8 | 1000 |
| 9 | 9 | 1001 |
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |
| D | 13 | 1101 |
| E | 14 | 1110 |
| F | 15 | 1111 |
Hex → decimal
Multiply each digit by its place value (16 for the left digit, 1 for the right) and add them up:
Decimal → hex
Divide by 16. The whole number is the first digit and the remainder is the second.
167 ÷ 16 = 10 remainder 7 → A7
Binary ↔ hex shortcut
Split binary into groups of four and convert each group on its own:
1010 0111 → A 7
Where you'll see it
- MAC addresses: 00:1A:2B:3C:4D:5E
- IPv6 addresses: 2001:db8::1
- Web colours: #FF8800
Try it
Flip bits and watch the decimal and hex values change together.
Frequently asked questions
- What is hexadecimal?
- Hexadecimal is base 16. It uses the digits 0–9 and then A–F for the values 10–15.
- How do you convert hex to decimal?
- Multiply each digit by its place value and add them up. For two digits, the left digit is worth 16 and the right digit 1: A7 = 10×16 + 7 = 167.
- How do you convert decimal to hex?
- Divide by 16. The whole number is the first hex digit and the remainder is the second: 167 ÷ 16 = 10 remainder 7, so 167 = A7.
- How do you convert binary to hex?
- Split the binary into groups of four bits and convert each group to one hex digit: 1010 0111 = A7.
Practise Hexadecimal as a game
The Binary Game turns this lesson into quick rounds with a breakdown after every answer. Free to start on iPhone and iPad.