Binary, Octal, Hex: A Developer's Guide to Number Bases
2026-06-03 · 6 min read
Why is memory measured in hex and permissions in octal? A practical tour of the number systems programmers actually use.
A number base is just how many distinct digits a system uses before it rolls over to the next place. We count in base 10 because we have ten fingers, but computers and the people who program them use a few other bases constantly.
Binary (base 2)
Binary uses only 0 and 1, mirroring the on/off states of transistors. It is how computers actually store everything, but it is verbose: the number 255 is 11111111.
Hexadecimal (base 16)
Hex uses 0–9 then A–F. Its appeal is that one hex digit maps exactly to four binary digits (a nibble), so two hex digits represent one byte. That is why colors (#FF8800), memory addresses, and byte dumps are written in hex — it is compact and lines up neatly with binary.
Octal (base 8)
Octal uses 0–7 and survives mainly in Unix file permissions, where 755 or 644 each encode three permission bits per digit.
A quick conversion trick: to read binary as hex, split it into groups of four bits from the right and convert each group. 1111 1000 = F8.
Converting between them
To convert any base to decimal, multiply each digit by its place value (the base raised to the position) and sum. Going the other way, repeatedly divide by the target base and read the remainders bottom-up. It is mechanical but error-prone by hand.
Do it instantly
The Number Base Converter shows binary, octal, decimal, and hex side by side — type in any one and the rest update, accurate even for very large numbers thanks to BigInt.