Humans count in decimal, computers store data in binary, and programmers often write values in hexadecimal. All three are the same idea — a number system with a different base — and once you see how bases work, converting between them becomes routine.
What Is a Base?
The base of a number system is how many digits it has. Decimal is base 10 (digits 0–9). Binary is base 2 (digits 0–1). Hexadecimal is base 16 (digits 0–9 plus the letters A–F, where A = 10 and F = 15). In every system, each position in a number is worth the base raised to a power: in decimal, the positions are 1, 10, 100, 1000; in binary, 1, 2, 4, 8; in hexadecimal, 1, 16, 256, 4096.
The Same Number, Three Ways
Take the value thirteen. Decimal writes it as 13. Binary writes it as 1101 (8 + 4 + 1). Hexadecimal writes it as D. A larger value, 255, is 11111111 in binary and FF in hex. Notice how much shorter hex is: every single hex digit represents exactly four binary digits, so a full byte is always just two hex digits.
Why Programmers Love Hexadecimal
Binary strings get long and hard to read — a single memory address can be 32 or 64 bits. Hexadecimal compresses those strings by a factor of four while staying easy to convert back to binary, unlike decimal where the conversion needs real arithmetic. That is why you see hex everywhere in computing: colour codes in web design (#FF5733), MAC addresses on network cards, memory addresses in error messages, and the raw bytes inside files.
When Each System Is Used
Decimal is for people: prices, measurements, everyday counting. Binary is for machines: it is what hardware physically stores and processes. Hexadecimal is the bridge — a human-readable shorthand for binary that programmers, network engineers and designers use daily. Octal (base 8) also appears occasionally, mainly in Unix file permissions.
Converting Between Them
Binary to hex: group the bits into fours from the right and replace each group with its hex digit — 1111 = F, 1010 = A. Hex to binary: expand each digit back into four bits. Binary to decimal: add up the place values of the 1 bits. Decimal to binary: repeatedly divide by 2 and read the remainders backwards. Our binary translator handles the text side of this — converting characters to and from their binary codes — while the grouping trick above covers raw numbers.
The Takeaway
There is no ‘best’ base, only the right one for the job. Decimal suits human intuition, binary suits hardware, and hexadecimal gives humans a compact way to talk about binary. Learn to move between them and a lot of computing — from colour pickers to network settings — suddenly makes sense.
