How Hexadecimal Works
Hexadecimal (hex) is a base-16 number system using digits 0-9 and letters A-F. Each hex digit represents 4 binary bits, making it ideal for representing binary data compactly.
FF₁₆ = 15×16 + 15×1 = 255₁₀ = 11111111₂
Hex Digit Reference
| Hex | Dec | Binary | Hex | Dec | 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 |
Frequently Asked Questions
Why is hex used in programming? Hex compactly represents binary data — each hex digit maps to exactly 4 bits. A byte (8 bits) is two hex digits, making memory addresses, colors, and binary data easy to read.
How do hex colors work? HTML/CSS colors use #RRGGBB format where each pair is a hex value 00-FF (0-255 in decimal) representing red, green, and blue intensity.