Binary to Decimal Converter Online

Convert any binary string to decimal with step-by-step powers-of-two expansion. Batch mode for hundreds of values, all four bases shown side-by-side — 100% in your browser.

Enter a binary string to see all four base representations.

What is binary to decimal conversion?

Binary to decimal conversion reads a string of 0s and 1s and computes its base-10 value. Each bit position represents a power of two; sum the powers where the bit is 1 to get the decimal value. This is the inverse of how computers natively store integers.

The OpenFormatter binary-to-decimal converter runs in your browser — no upload, no rate limit, no account. It returns the decimal value, the equivalent hex and octal for context, and a bit-by-bit powers-of-two expansion that explains exactly which bits contribute to the total.

How to convert binary to decimal — 4 steps

  1. Enter the binary string. Up to 53 bits, optional 0b prefix. Whitespace is ignored, but anything other than 0 and 1 raises an error.
  2. Read the decimal output. The result appears immediately, with hex and octal alongside.
  3. Study the expansion. Each set bit is multiplied by its place value (2n) and the partials are summed.
  4. Switch to batch mode. Convert many bit strings at once and copy the table to a spreadsheet.

Sample input and output

Input:  101010

Output:
  Binary:  101010
  Decimal: 42
  Hex:     0x2A
  Octal:   0o52

Expansion: 101010₂ = 32 (2^5) + 8 (2^3) + 2 (2^1) = 42

Each 1 bit is a power of two; sum them. The leftmost bit has the highest place value because positions count from the right starting at 0.

Single + Batch Modes

Decode a single bit pattern with full expansion, or paste hundreds of bit strings (one per line) for a copyable conversion table.

Educational Expansion

Powers-of-two breakdown shows exactly which bit positions contribute — perfect for learning how positional notation works.

Client-Side Only

All math runs in the browser via parseInt(string, 2). Nothing is uploaded — verify in DevTools Network.

Common use cases

  • check_circleDecoding bit patterns from register dumps and hardware datasheets
  • check_circleReading subnet masks (11111111.11111111.11111111.00000000 → 255.255.255.0)
  • check_circleTranslating Unix permissions in 9-bit form back to a decimal mode value
  • check_circleComputer architecture coursework — converting examples between bases
  • check_circleParsing protocol fields in IPv6, TCP flags, ICMP types, and packet captures
  • check_circleEmbedded firmware — interpreting status bytes, GPIO state, peripheral flags
  • check_circleReverse engineering — rebuilding integer constants from disassembled bit patterns
  • check_circleJob interviews and whiteboards — quickly verifying bit-level reasoning

The conversion math, explained

The tool calls parseInt(string, 2). Internally that is a Horner-method polynomial evaluation: walk the bits left to right, multiply the running total by 2, then add the current bit. For 101010: 0·2+1=1, 1·2+0=2, 2·2+1=5, 5·2+0=10, 10·2+1=21, 21·2+0=42. Equivalently, 101010 = 1·25 + 0·24 + 1·23 + 0·22 + 1·21 + 0·20 = 32+0+8+0+2+0 = 42. The expansion panel shows only the set bits, since the zeros contribute nothing.

Need the reverse direction?

Browse the rest of the OpenFormatter base toolkit — every conversion runs in your browser.

Frequently Asked Questions

How do I convert binary to decimal manually?

For each bit that equals 1, add 2 raised to the bit's position (counting from the right, starting at zero). For 101010: bit 1 at position 5 = 32, bit 1 at position 3 = 8, bit 1 at position 1 = 2 → 32+8+2 = 42. Programmatically, JavaScript does this with parseInt(string, 2).

What is the largest binary I can convert?

Up to 53 bits, because JavaScript numbers only guarantee integer precision to 2^53 − 1 (Number.MAX_SAFE_INTEGER). For longer bit strings, use BigInt: BigInt("0b" + bits) parses arbitrary-length binary into an exact integer.

Does the input accept a 0b prefix?

Yes. The converter accepts 0b101010 or just 101010 — both parse to 42 decimal. Whitespace is also stripped. Anything other than 0, 1, or the 0b prefix triggers an error.

Why might my binary parse as a wrong number?

The two most common causes are accidental whitespace inside the bit string (the regex requires contiguous 0/1) and bit-length overflow above 53. The validator surfaces both. If you copied bits from a hex dump, double-check that the source did not pad with letters or formatting characters.

How does parseInt(s, 2) actually work?

It walks the string left-to-right, multiplies the accumulator by 2 at each step, and adds the current bit. For "1010": 0·2+1=1, 1·2+0=2, 2·2+1=5, 5·2+0=10 → decimal 10. This is the standard Horner-method polynomial evaluation, the same approach a CPU uses internally.

Can the tool handle two's complement / signed binary?

No — this tool treats input as an unsigned magnitude. To interpret a fixed-width two's-complement value, prepend the sign bit logic yourself: if the top bit is 1, subtract 2^width to recover the negative value. For example, 8-bit 11111111 unsigned is 255 but two's-complement is −1.

Why are leading zeros allowed?

Leading zeros are ignored mathematically — 00001010 and 1010 both equal 10 — but they preserve bit width visually. We keep them in the input so you can paste 8-bit, 16-bit, or 32-bit fields exactly as they appear in a register dump or protocol spec.

Is the data sent to a server?

No. All conversion happens in JavaScript inside your browser. Open DevTools → Network and confirm zero requests when you click Convert. Safe for internal data, secret keys, or proprietary numeric values.

Binary to Decimal Converter Online — Free Base-2 to Base-10 Tool