Skip to content

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 digits 0 to F with decimal value and 4-bit binary
HexDecimalBinary
000000
110001
220010
330011
440100
550101
660110
770111
881000
991001
A101010
B111011
C121100
D131101
E141110
F151111

Hex → decimal

Multiply each digit by its place value (16 for the left digit, 1 for the right) and add them up:

A
10
1010
×16
7
7
0111
×1
10×16 + 7 = 167

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.

Decimal
0
Hex
00
Binary
0000 0000

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.