What is hexadecimal?
Short answer
Hexadecimal (hex) is a base-16 number system using the digits 0-9 and the letters A-F. It is popular in computing because each hex digit maps neatly to exactly four binary bits, making long binary values short and readable.
Counting in base 16
Decimal uses ten digits, 0-9. Hexadecimal uses sixteen, so after 9 it continues with A (10), B (11), C (12), D (13), E (14), and F (15). The value FF therefore means 15 times 16 plus 15, which is 255.
hex A = decimal 10 = binary 1010
hex F = decimal 15 = binary 1111
hex FF = decimal 255 = binary 1111 1111Why computing loves hex
A byte is eight bits, which is exactly two hex digits. That clean mapping makes hex a compact shorthand for binary: a 32-bit value fits in eight hex digits instead of a wall of ones and zeros. Hex usually appears with a 0x prefix, as in 0x1F.
Where you see it
- CSS and design colors, such as
#2563EB, which is three bytes of red, green, and blue - Memory addresses and byte dumps in debuggers
- Character codes and Unicode code points, such as U+1F600
- Hashes and identifiers written as long hex strings