Skip to main content

Binary, Decimal, Hex, and Octal — Number Systems Explained Simply

January 30, 2026 · 8 min read

Why computers use binary, why developers use hex, and how to convert between every common number base.

Why number bases exist

A number base is just how many symbols you use before you have to add another digit. We use 10 (0–9) because we have ten fingers. Computers use 2 (0, 1) because circuits are either on or off.

Decimal (base 10)

The system we grew up with. Each position is 10× the one to its right: ones, tens, hundreds, thousands.

Binary (base 2)

Only 0 and 1. Each position is 2× the one to its right: 1, 2, 4, 8, 16, 32, 64, 128. So 11111111 = 128+64+32+16+8+4+2+1 = 255.

Hexadecimal (base 16)

Digits 0–9 then A–F (10–15). One hex digit packs exactly four binary digits, which is why developers love it: FF = 11111111 = 255. Color codes are hex. Memory addresses are hex. Hash digests are hex.

Octal (base 8)

Digits 0–7. Mostly used today for Unix file permissions (chmod 755) because each digit represents three permission bits.

Converting manually

Decimal to binary: repeatedly divide by 2, collect remainders bottom-up. Binary to hex: group bits in fours from the right, convert each group. Hex to binary: expand each hex digit to four bits.

Where you see these in real life

CSS colors (#FF6B6B), IP addresses (binary masks), Unicode code points (U+1F600), MAC addresses, file permissions, debug logs, and every API that returns a hash.

Frequently asked questions

What is 255 in binary?

11111111 (eight 1s). It's the largest value an 8-bit byte can hold.

What is FF in decimal?

255. Two hex digits cover 0 to 255 exactly.

Try the tools: