How to Convert Binary to Decimal in Your Head
Let me be honest with you: the first time I saw binary in a textbook, I assumed it was something only compiler engineers needed to care about. Then I started working with microcontrollers, and suddenly I was staring at bit masks like 0b10110100 and thinking, "okay, what is that in decimal?" Reaching for a calculator every single time got old fast. So I learned two tricks — the place-value method and the doubling method — and now I can read most 8-bit values in my head in about four seconds.
This article walks you through both approaches, with real examples. By the end you'll have a concrete mental technique you can actually use, not just a vague "it's powers of two, good luck."
First, Why Binary Even Exists
Binary is base-2, meaning the only digits are 0 and 1. Computers use it because transistors have two stable states: on and off. Every bit is one transistor. So when a CPU stores a number, it's storing a pattern of on/off switches — which is exactly what a string of 1s and 0s represents.
Decimal is base-10 because humans have ten fingers. Each position in a decimal number represents a power of 10: ones, tens, hundreds, thousands. Binary works identically, except each position represents a power of 2: 1, 2, 4, 8, 16, 32, 64, 128. That list is the key to everything that follows.
Method 1: The Place-Value Table
This is the most direct approach. Write out (or memorize) the powers of 2, align them above the binary digits, then add up only the positions where a 1 appears.
Let's convert 10110101 to decimal.
Step 1 — Write the place values from right to left:
| Bit position | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Place value (2ⁿ) | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| Binary digit | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 |
Step 2 — Circle or mentally note each place value where the binary digit is 1:
- Position 7 → 128 ✓
- Position 6 → 64 (digit is 0, skip)
- Position 5 → 32 ✓
- Position 4 → 16 ✓
- Position 3 → 8 (digit is 0, skip)
- Position 2 → 4 ✓
- Position 1 → 2 (digit is 0, skip)
- Position 0 → 1 ✓
Step 3 — Add them up: 128 + 32 + 16 + 4 + 1 = 181.
That's it. The whole trick is memorizing eight numbers: 1, 2, 4, 8, 16, 32, 64, 128. If you work with binary at all — even just reading color hex codes — these eight values will eventually live in your head rent-free. Until then, write them on a sticky note.
A Faster Pattern for 8-Bit Values
Notice that 8-bit binary always falls between 0 and 255 (which is 11111111 in binary — all eight bits set). When you see a byte like 11111111, you instantly know it's 255. When you see 10000000, it's exactly 128. When you see 11000000, it's 128 + 64 = 192. You start building a feel for ranges: anything starting with 1 is ≥128; anything starting with 11 is ≥192.
This range intuition alone makes reading subnet masks readable. 11111111.11111111.11111111.00000000 is 255.255.255.0 — the classic /24 mask. You stop needing to count digit by digit.
Method 2: The Doubling Method (Left to Right)
The place-value approach requires you to hold several numbers in memory and sum them. The doubling method replaces that with a single running total you update one step at a time — which is often easier mid-task when you can't write anything down.
The rule: Start with 0. For each bit from left to right, double your current total, then add the bit.
Let's convert the same number: 10110101.
- Start: 0
- Read bit 1 (value 1): 0 × 2 + 1 = 1
- Read bit 0 (value 0): 1 × 2 + 0 = 2
- Read bit 1 (value 1): 2 × 2 + 1 = 5
- Read bit 1 (value 1): 5 × 2 + 1 = 11
- Read bit 0 (value 0): 11 × 2 + 0 = 22
- Read bit 1 (value 1): 22 × 2 + 1 = 45
- Read bit 0 (value 0): 45 × 2 + 0 = 90
- Read bit 1 (value 1): 90 × 2 + 1 = 181
Same answer: 181. Each step is just "double what I have, add the next digit." The arithmetic never gets harder than multiplying a two- or three-digit number by 2, which most people can do mentally without much strain.
Why Doubling Works
It's just Horner's method in disguise. The binary number 10110101 can be written as:
1×2⁷ + 0×2⁶ + 1×2⁵ + 1×2⁴ + 0×2³ + 1×2² + 0×2¹ + 1×2⁰
Which factors into:
((((((1×2+0)×2+1)×2+1)×2+0)×2+1)×2+0)×2+1
That's exactly what you're computing when you go step by step: multiply by 2, add the bit, repeat. No memorized table required.
Connecting This to Color and Timestamp Converters
Binary-to-decimal conversion isn't just a CS-101 exercise. You run into it constantly:
Hex Color Codes
A hex color like #FF5733 is three byte-values: FF, 57, 33 — one each for red, green, blue. Hex is base-16, so each hex digit maps to exactly four binary bits (a "nibble"). The digit F is 1111 in binary; 5 is 0101; 7 is 0111; 3 is 0011.
So 57 in hex is 0101 0111 in binary, which you can verify: 64+16+4+2+1 = 87 in decimal. The green channel of #FF5733 is 87/255 ≈ 34% brightness. When you're fine-tuning CSS colors or GLSL shaders, thinking in these terms helps you make principled adjustments rather than random hex tweaks.
Unix Timestamps
Unix time (seconds since 1970-01-01 00:00:00 UTC) is stored as a 32-bit or 64-bit integer. You'll see it in database dumps, API responses, log files. The value 1718000000, for example, corresponds to roughly June 2024 — but your eye glazes over at a raw integer. Some developers use binary-to-decimal conversion mentally to sanity-check whether a timestamp is in a plausible range: 32-bit signed timestamps top out at 2147483647 (the famous "2038 problem"), and knowing that value in binary is 01111111 11111111 11111111 11111111 — all bits set except the sign bit — gives you a memorable anchor.
Practice: Three Numbers to Try Right Now
Don't just read this and move on. Try converting these before you scroll down:
000010101100110001111111
Take thirty seconds. Use whichever method felt more natural.
Answers:
- 0+0+0+0+8+0+2+0 = 10
- 128+64+0+0+8+4+0+0 = 204
- 0+64+32+16+8+4+2+1 = 127 (the max value of a signed byte — another good one to memorize)
When to Just Use a Calculator
Let's be pragmatic. Mental conversion is genuinely useful for 4-bit and 8-bit values. Once you're past 8 bits, the place values get large (256, 512, 1024…) and the doubling method can produce numbers that are unwieldy to track mentally. For 16-bit or 32-bit numbers, use a converter tool — your time is better spent on the work, not the arithmetic.
The goal of learning the mental method isn't to never use calculators. It's to build enough intuition that you can glance at a byte, get a ballpark, and catch obvious errors. If a sensor is supposed to return values near 200 and it's sending 00001010, you should immediately know something is wrong without having to open a browser tab.
Building the Habit
The fastest way to internalize this is repeated low-stakes exposure. Set your code editor's color theme using raw hex values and convert them mentally before pasting. When you see a network mask in documentation, read the binary version. Keep the powers-of-2 sequence (1, 2, 4, 8, 16, 32, 64, 128) visible near your desk until it's automatic.
Within a week of this kind of casual practice, 8-bit binary stops looking like noise. You'll start seeing numbers in it — and that shift is genuinely useful, not just a party trick.