255, 0xFF, 11111111 — three ways of writing the same number. Decimal is how humans count; binary is how computers count; hexadecimal is the shorthand programmers use to read binary.
The three bases that matter
- Decimal (base 10): ten digits, 0–9. Your default.
- Binary (base 2): two digits, 0 and 1. Every number in a computer is ultimately binary — a byte is 8 bits, and 8 bits can hold 0–255.
- Hexadecimal (base 16): sixteen digits, 0–9 then A–F. One hex digit represents exactly 4 bits — which makes it the most readable way to write binary.
FFis11111111.
Why hex wins for programmers
One byte = 2 hex digits. That’s the whole trick:
11111111(8 digits, error-prone) =FF(2 digits).- Colors:
#4F46E5is three bytes — red, green, blue — each written as two hex digits. - Memory addresses, checksums, and binary dumps all use hex for the same reason: compact and directly mappable to bits.
Converting
The base converter translates between binary, decimal, hex, and octal instantly — type a value in any base, read the others. That beats the manual method (repeatedly dividing by the base and collecting remainders), which is how the conversion actually works, but which nobody should do by hand for numbers over 100.
The two facts worth memorizing
- Powers of two: 2, 4, 8, 16, 32, 64, 128, 256 — they show up everywhere in computing.
FF= 255: the largest value one byte can hold. When you see “255” in a config, someone is talking about a full byte.
Number bases feel alien for about ten minutes, then they click — and a big slice of computing becomes readable.