Binary ↔ Decimal Converter

Convert between binary strings and decimal integers.

Inputs

Loading calculator…
Calculating…
Was this helpful?

Formula

Decimal = Σ (bitᵢ × 2ⁱ) · Binary = repeated division by 2, remainders read backward

Each binary digit is a power of two. Reading right to left, the rightmost bit is 2⁰, the next 2¹, and so on. Converting decimal to binary records remainders from successive halving.

Worked example

1010₂ = 1×8 + 0×4 + 1×2 + 0×1 = 10₁₀ — the same nibble you'd see in a four-bit register or IPv4 subnet nibble.

Where this can give the wrong answer

  • Binary strings must contain only 0 and 1 — leading zeros are allowed in the preset options.
  • Decimal inputs must be non-negative integers; fractions have infinite binary expansion and aren't supported.
  • Values above 2⁵³ − 1 may lose precision in JavaScript — the calculator caps conversion accordingly.

FAQ

Bytes are 8 binary bits. Converting 1024 to binary yields the bit pattern behind 1 KB in binary counting — pair with the data storage converter for KB/MB scaling.