Guides
Why Developers Use Hexadecimal (And You Should Too)
Every number system is a way to count with a different set of hands. Decimal has ten digits, binary has two, and hexadecimal — hex — has sixteen. The first time a beginner sees #FF7F50 in a stylesheet it looks like gibberish. It is not gibberish. It is the most compact honest way to write a byte that humans ever agreed on.
The byte, the reason everything fits
Computers think in bytes: 8 bits, 256 possible values, 0 to 255. Here is the trick that makes hex special: 16 = 24, so one hex digit holds exactly 4 bits, and two hex digits hold exactly 8 bits — one whole byte. There is no remainder, no rounding, no lost information.
- 1 hex digit = 4 bits = a nibble (0–15)
- 2 hex digits = 8 bits = a byte (0–255)
- 4 hex digits = 16 bits = a short (0–65535)
Where hex actually shows up
Walk through a normal week of programming and hex is behind half the punctuation:
- CSS colors:
#RRGGBBis three bytes.#48A3FFis red 72, green 163, blue 255. - Memory addresses: a pointer like
0x7ffe4a21is the shortest stable label for a location in RAM. - MAC addresses:
3C:58:C2:DC:EA:76is six bytes of hex with colons. - IP to hex: each octet is one byte;
192.168.1.5reads as hex C0 A8 01 05. - Hashes: a SHA-256 digest is simply 32 bytes rendered as 64 hex digits.
Why not just use binary or decimal
Binary is the truth but it is unusably long — 255 is 11111111, eight characters for one byte, and the eye can not spot a misread digit. Decimal is compact but it breaks the byte boundary: 255 in decimal hides the structure of a byte, so crossing into the next byte is a silent, error-prone stumble. Hex gives you compactness and structure at the same time. It is the only system that is both short enough to type and exact enough to debug.
Converting hex to decimal, the honest way
Each position is a power of 16, counting from the right starting at zero. Take 2F:
Reverse the direction for decimal to hex by dividing by 16 and reading the remainders up. Do it once slowly, then never again: paste the value into the converter on this page and read all four bases side by side.
The two-minute rule
If a number travels between software and a human being (a color, an address, a checksum), someone eventually writes it in hex. Learning to read base 16 is not an exam chore — it is learning the native shorthand of the systems you use all day. Start with 00 to FF, learn that A is ten, and an afternoon later the 0x prefixes stop being mysterious.