Binary to Decimal Converter

Convert binary numbers to decimal (base 10) instantly. Supports grouped input with spaces.

How to Convert Binary to Decimal

Binary is base-2, so each position represents a power of 2:

  1. Starting from the right, assign each bit a power of 2 (2⁰, 2¹, 2², ...)
  2. Multiply each bit (0 or 1) by its power of 2
  3. Sum all the results

Example: Convert 1010 to decimal:

  • 1 × 2³ = 8
  • 0 × 2² = 0
  • 1 × 2¹ = 2
  • 0 × 2⁰ = 0
  • Result: 8 + 0 + 2 + 0 = 10

Code Examples

const binary = "1010";
const decimal = parseInt(binary, 2); // 10
// With 0b prefix:
const value = 0b1010; // 10

Frequently Asked Questions

How do I convert binary to decimal?

Multiply each binary digit by its position value (2^n, starting from 0 on the right) and sum the results. For example, 1010 = (1×8) + (0×4) + (1×2) + (0×1) = 10.

Why do computers use binary?

Computers use binary because electronic circuits have two stable states: on (1) and off (0). This makes binary the most reliable way to store and process data electronically.

What is a nibble?

A nibble is 4 bits, which is half a byte. One nibble can represent values 0-15, which corresponds to exactly one hexadecimal digit. Binary is often grouped into nibbles for readability.

Related Tools