Base Converter guide
How to Convert Hexadecimal to Decimal
Hexadecimal uses sixteen digits: 0 to 9, then A to F for the values 10 to 15. To convert to decimal, give each digit a place value that multiplies by 16 from right to left, then add the results. FF is (15 × 16) + 15 = 255.
The letters are just digits
Hexadecimal needs sixteen different digits, but we only have ten number symbols. So the first six letters of the alphabet fill in for the rest.
| Hex | A | B | C | D | E | F |
|---|---|---|---|---|---|---|
| Decimal | 10 | 11 | 12 | 13 | 14 | 15 |
Place values multiply by 16
Just as decimal places are 1, 10, 100, 1000 and binary places are 1, 2, 4, 8, hexadecimal places are 1, 16, 256, 4096.
Each position is worth sixteen times the one to its right. That is the entire structure.
For FF: the left F is in the 16s place and the right F is in the 1s place. F is 15, so that is (15 × 16) + (15 × 1) = 240 + 15 = 255.
A longer example
Take 2AF. Three digits, so the place values are 256, 16 and 1.
2 is in the 256s place: 2 × 256 = 512.
A is 10, in the 16s place: 10 × 16 = 160.
F is 15, in the 1s place: 15 × 1 = 15.
Adding: 512 + 160 + 15 = 687.
The only genuinely new skill here is remembering the letter values. Everything else is the same place-value arithmetic you already do.
Spotting a hex number in the wild
Hex is usually marked so you know it is not decimal, and the notation varies by context:
- 0x2AF — the C, Java, JavaScript and Python convention
- #FF7F50 — CSS and design tools, for colours
- 2AFh — assembly language
- $2AF — older systems and some calculators
Why two hex digits are so convenient
Two hex digits cover exactly 0 to 255 — precisely the range of one byte. That is not a coincidence, and it is the main reason hex is used at all.
It means a byte is always written as exactly two hex characters, never one and never three. Memory dumps, colour codes and file formats all line up neatly in columns because of it.
The same number in binary would need eight characters and be far harder to read at a glance. FF is easier to scan than 11111111, and they mean the same thing.