Base 16 and Why It Exists
Hexadecimal uses sixteen digits: 0–9 then A–F for ten to fifteen. Its value in computing comes from one fact — each hex digit corresponds to exactly four binary digits, so any binary string converts to hex by grouping in fours, with no arithmetic at all.
Hex Digit Chart
| Hex | Decimal | Binary | Hex | Decimal | Binary |
|---|---|---|---|---|---|
| 0 | 0 | 0000 | 8 | 8 | 1000 |
| 1 | 1 | 0001 | 9 | 9 | 1001 |
| 2 | 2 | 0010 | A | 10 | 1010 |
| 3 | 3 | 0011 | B | 11 | 1011 |
| 4 | 4 | 0100 | C | 12 | 1100 |
| 5 | 5 | 0101 | D | 13 | 1101 |
| 6 | 6 | 0110 | E | 14 | 1110 |
| 7 | 7 | 0111 | F | 15 | 1111 |
Reading a Hex Number
Place values are powers of 16. 1A3F is:
1×4096 + 10×256 + 3×16 + 15×1 = 6,719
Where You Meet Hex
- Colour codes — #FF5733 is three bytes: red 255, green 87, blue 51.
- Memory addresses — compact and aligned to byte boundaries.
- MAC addresses — six bytes written as twelve hex digits.
- Unicode code points — U+1F600 is the grinning face emoji.
- Error codes and hashes — MD5 and SHA outputs are always written in hex.
Notation
Hex numbers are marked in several ways depending on context: 0x1A3F in C, JavaScript and Python; #1A3F for colours; 1A3Fh in assembly; and $1A3F in older systems. All mean the same value.
Frequently Asked Questions
Why not use octal instead?
Octal groups bits in threes, which does not divide evenly into 8-bit bytes. Hex groups in fours, so exactly two hex digits make a byte. Octal was common when word sizes were multiples of three, and survives mainly in Unix file permissions.
Is hex case sensitive?
No. 1a3f and 1A3F are identical. Uppercase is conventional for values, lowercase common in hashes and colour codes.
How do I convert hex to binary quickly?
Replace each digit with its four-bit pattern from the chart above. 1A3F becomes 0001 1010 0011 1111. No arithmetic required.