How hexadecimal works
Hexadecimal is base 16: the digits are 0–9 and then A (10), B (11), C (12), D (13), E (14) and F (15). Each place is worth 16 times the one to its right.
2F = 2 × 16 + 15 = 47
FF = 15 × 16 + 15 = 255
One hex digit is exactly four binary digits, so hex is a compact way to write binary.
Example
1A + 2F in hex: 26 + 47 = 73 in decimal, which is 49 in hex (4 × 16 + 9). FF converts to 255 in decimal and 11111111 in binary.
Tips
- Web colours are hex: #FF8800 means red FF (255), green 88 (136), blue 00.
- A leading 0x (as in 0x1A) is accepted and ignored.
- For binary arithmetic and bitwise operations, use the binary calculator.
Frequently asked questions
What is FF in decimal?
255.
What is 100 in hex?
64.
Why do programmers use hex?
Each hex digit maps to exactly 4 bits, so bytes become two tidy hex digits instead of eight binary ones.
Written and checked by Vijay. Last updated .