1What a number base actually is (start from zero)
Count on your fingers: 1, 2, 3… 9, and then you're out of digits, so you start a new column and write 10. That "ten digits, then a new column" system is called base 10 (decimal), and the only reason we use it is that humans have ten fingers. It's a biological accident, not a mathematical law.
A base is simply how many distinct digits you get before rolling over to a new column. Base 2 (binary) gives you two digits — 0 and 1 — so counting goes 0, 1, 10, 11, 100… Base 16 (hexadecimal) gives you sixteen digits — 0–9 plus A–F — so counting goes 0…9, A, B, C, D, E, F, 10 (which means sixteen).
The deep point: the quantity doesn't change, only the writing does. Ten apples are ten apples whether you write "10" (decimal), "1010" (binary), "12" (octal) or "A" (hex). Bases are languages, not numbers. Once that clicks, converting is just translation.
Each column in any base is worth the base raised to a power. In decimal, the columns are worth 1, 10, 100, 1000… In binary, they're worth 1, 2, 4, 8, 16… That's the entire machinery — everything else in this guide is that idea, applied.
2The four bases that matter
Dozens of bases exist mathematically, but in practice you'll meet exactly four:
| Base | Name | Digits | Where you meet it |
|---|---|---|---|
| 2 | Binary | 0, 1 | Inside every computer — the hardware's native language |
| 8 | Octal | 0–7 | Unix file permissions (like chmod 755) |
| 10 | Decimal | 0–9 | Everyday life — prices, ages, phone numbers |
| 16 | Hexadecimal | 0–9, A–F | Color codes, memory addresses, MAC addresses |
Binary: the machine's mother tongue
Two digits, endless combinations. A single binary digit is a bit; eight bits are a byte. Everything digital — your photos, your messages, this article — is stored as long strings of bits. Binary is verbose for humans (255 is eight digits: 11111111) but perfect for hardware.
Octal: the quiet survivor
Base 8 groups bits in threes — one octal digit per 3 bits. It was popular on early computers with 12-bit and 24-bit words, and it survives today in one famous place: Unix file permissions. When you type chmod 755, those three octal digits each encode three permission bits (read/write/execute) for owner, group, and others.
Hexadecimal: binary's readable costume
Base 16 groups bits in fours — one hex digit per 4 bits (a nibble), two hex digits per byte. That's why hex won over octal: bytes are 8 bits, and 8 divides evenly by 4 but not by 3. FF is instantly readable where 11111111 is a wall of digits.
3Why computers love binary (and why humans don't)
Computers use binary because hardware is simplest with two states. A transistor is either on or off; a voltage is either high or low; a magnetic spot points either north or south. Building a reliable component with exactly two states is cheap and robust. Building one with ten distinct, reliably distinguishable states is an engineering nightmare.
So everything — text, images, music, video — gets encoded as patterns of bits. The letter "A" is 01000001. A pixel's redness is a number from 0 to 255. Your voice on a call is thousands of amplitude samples per second, each a binary number. It's all just on/off patterns, interpreted by agreement.
Humans hate binary because it's unreadable at scale. Is 1011011010110100 a big number or a small one? You can't tell at a glance. That's why programmers use hex as the human interface to binary: B6B4 carries the same information in a quarter of the digits, and each hex digit maps to exactly 4 bits, so translation is mechanical.
The powers of two are worth knowing by heart — they show up constantly in computing, from RAM sizes to file limits:
| Power | Value | You'll meet it as |
|---|---|---|
| 2¹⁰ | 1,024 | ~1 thousand — the old "K" |
| 2¹⁶ | 65,536 | Max 16-bit value + 1 |
| 2²⁰ | 1,048,576 | ~1 million — the old "M" |
| 2²⁴ | 16,777,216 | Number of RGB colors |
| 2³⁰ | 1,073,741,824 | ~1 billion — the old "G" |
| 2³² | 4,294,967,296 | Max 32-bit value + 1 (the famous 4 GB limit) |
4Converting by hand: the exact methods
Two directions, two methods. Learn them once and you'll never feel lost in a hex dump again.
To decimal: multiply by place values and add
Write the place values (powers of the base) under each digit, multiply, and add. In binary the places are 1, 2, 4, 8…; in hex they're 1, 16, 256…
From decimal: divide by the base, keep remainders
Divide the number by the target base, write down the remainder, repeat with the quotient — then read the remainders bottom-to-top (last remainder first).
1111 1111 → F F. No division needed — this is the trick programmers actually use.5Reference: 0–20 in all four bases
The Rosetta Stone of number bases. Notice how binary explodes in length while hex stays compact:
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 3 | 11 | 3 | 3 |
| 4 | 100 | 4 | 4 |
| 5 | 101 | 5 | 5 |
| 6 | 110 | 6 | 6 |
| 7 | 111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 17 | 10001 | 21 | 11 |
| 18 | 10010 | 22 | 12 |
| 19 | 10011 | 23 | 13 |
| 20 | 10100 | 24 | 14 |
Two landmarks to memorize: 15 = F (the biggest single hex digit, four 1-bits) and 255 = FF (the biggest byte). Between them you can sanity-check almost any conversion.
6Hex in the wild: colors, addresses, and 0x
Hexadecimal is the one non-decimal base ordinary people meet regularly — usually without realizing it:
- Color codes.
#FF5733is three hex bytes: FF red, 57 green, 33 blue. Every color picker, every CSS file, every design tool speaks hex. - Memory addresses. Debuggers and crash reports show addresses like
0x7ffee4b8— hex keeps long binary addresses readable. - MAC addresses. Your network hardware's ID looks like
3C:22:FB:91:A0:5D— six hex bytes. - Unicode. That emoji you just sent is code point U+1F600 — hex again.
- File permissions. The octal survivor:
chmod 755on a server, where each digit is three permission bits.
The 0x prefix is how code marks a number as hexadecimal: 0xFF means "hex FF" (255), not the letters F-F. You'll see it in C, Python, JavaScript and Rust — anywhere programmers write raw values and need to be unambiguous about the base. (Some contexts use a trailing h instead, like FFh in assembly.)
7Common mistakes to avoid
- Reading remainders top-to-bottom. In the divide-by-base method, the last remainder is the leftmost digit. Reading them in order gives you the number backwards.
- Forgetting hex digits go past 9. A=10, B=11, C=12, D=13, E=14, F=15. A remainder of 13 is the digit D, not "13".
- Mixing up 0xFF and "FF". In code,
0xFFis the number 255; a bareFFin most languages is a variable name or an error. The prefix matters. - Assuming leading zeros don't matter.
007and7are the same value, but in fixed-width contexts (like a byte shown as0F) the zero carries meaning about width. - Confusing octal 10 with decimal 10. Octal 10 is eight. Always note the base — that's what the subscripts (1010₂, FF₁₆) are for.
8Pro tips
- Binary ↔ hex via nibbles: group bits in fours from the right; each group is one hex digit. Fastest conversion there is.
- Memorize the landmarks: 1111₂ = F₁₆ = 15, 11111111₂ = FF₁₆ = 255. Most real-world conversions sit near these.
- Powers of two, doubled: 1, 2, 4, 8, 16, 32, 64, 128, 256… — say them until they're reflex. They're the place values of binary.
- When in doubt, go through decimal. Weird base → decimal → target base always works, even if it's not the fastest route.
Convert any base in seconds
Binary, octal, decimal, hexadecimal — convert between all four instantly, with every value shown at once. Free, private, no signup.
🔢 Open the Number Base Converter100% free · No account · Private by design
9Frequently asked questions
What is hexadecimal used for?
Hexadecimal is a compact way to write binary data: one hex digit represents exactly 4 bits. It's used for color codes (#FF5733), memory addresses, MAC addresses, and anywhere programmers need to read raw bytes comfortably.
Why do computers use binary?
Because hardware is simplest with two states: on/off, high/low voltage. A transistor holding one of two states is reliable and cheap to build. Everything a computer does — text, images, video — is ultimately encoded as patterns of these two states.
How do I convert binary to decimal?
Multiply each bit by its place value (powers of 2, right to left: 1, 2, 4, 8…) and add. 1010₂ = 1×8 + 0×4 + 1×2 + 0×1 = 10. The converter does it instantly, but the method is worth learning once.
What is the difference between octal and hexadecimal?
Both are shorthands for binary: octal groups bits in threes (one octal digit = 3 bits), hexadecimal groups them in fours (one hex digit = 4 bits). Hex won because 4-bit groups (nibbles) align perfectly with 8-bit bytes.
What does the 0x prefix mean?
0x marks a number as hexadecimal in code — 0xFF means hex FF (255 in decimal), not the letters F-F. You'll see it in C, Python, JavaScript and CSS-adjacent contexts wherever programmers write raw values.
Why is 255 the maximum value of one byte?
A byte is 8 bits, and the largest 8-bit pattern (11111111₂) equals 255 in decimal — or FF in hex. That's why 255 shows up everywhere: color channels, network masks, and old game scores all max out at 255.
Keep exploring
Number bases power the digital world — these tools live in it:
Related guides
More step-by-step guides on this topic:
