Guide
How to convert binary to decimal step by step
Convert a binary integer to decimal by adding powers of two, with a fully worked example and an exact reverse check.
by Tools in a Tab · Published on · Reviewed on
Short answer
To convert a binary integer to decimal, number its positions from zero starting
at the right. Multiply each bit by 2 raised to its position and add the
results. A 0 bit contributes nothing; every 1 bit contributes the matching
power of two.
Example: convert 101101 to decimal
Break down the six positions:
| Bit | Position | Place value | Contribution |
|---|---|---|---|
1 |
5 | 2⁵ |
32 |
0 |
4 | 2⁴ |
0 |
1 |
3 | 2³ |
8 |
1 |
2 | 2² |
4 |
0 |
1 | 2¹ |
0 |
1 |
0 | 2⁰ |
1 |
101101₂ = 32 + 8 + 4 + 1 = 45₁₀
Paste 0b101101 or select binary input in the
number base converter to verify the
decimal result 45.
An accumulating method for long values
You can also scan from left to right. At each step, multiply the previous result by two and add the new bit:
1 → 2 → 5 → 11 → 22 → 45
This is equivalent to summing powers. It avoids writing a wide table and maps naturally to processing a string of bits.
Leading zeros, signs, and two’s complement
Leading zeros do not affect the value: 00101101 is still decimal 45. An
explicit sign applies to the whole number, so mathematical -101101₂ means
-45₁₀.
Do not automatically interpret the first bit as a sign. The pattern
11111111 is unsigned decimal 255, but a protocol may define it as -1
using 8-bit two’s complement. Without that width and signed convention, there
is no single negative interpretation.
Common mistakes and a reverse check
- Starting positions at
1; the rightmost digit always has weight2⁰ = 1. - Accepting a digit other than
0or1. - Dropping an internal zero and shifting every bit that follows it.
- Using floating-point arithmetic for integers beyond a language’s exact range.
For a reverse check, repeatedly divide the decimal value by two and read the
remainders from last to first. The tool’s exact large-integer operations use
the BigInt representation defined by
ECMAScript.