Binary to Decimal Converter Formula

Understand the math behind the binary to decimal converter. Each variable explained with a worked example.

Formulas Used

Decimal Value

decimal_val = b7*128 + b6*64 + b5*32 + b4*16 + b3*8 + b2*4 + b1*2 + b0*1

Variables

VariableDescriptionDefault
b7Bit 7 (128s)0
b6Bit 6 (64s)0
b5Bit 5 (32s)0
b4Bit 4 (16s)0
b3Bit 3 (8s)1
b2Bit 2 (4s)0
b1Bit 1 (2s)1
b0Bit 0 (1s)0

How It Works

How to Convert Binary to Decimal

Method

Each position in a binary number represents a power of 2, starting from 2^0 on the right.

Decimal = b7×128 + b6×64 + b5×32 + b4×16 + b3×8 + b2×4 + b1×2 + b0×1

For example, binary 00001010:

  • Position 3 (8s place): 1 × 8 = 8
  • Position 1 (2s place): 1 × 2 = 2
  • Total: 8 + 2 = 10
  • Worked Example

    Convert binary 00001010 to decimal.

    b7 = 0b6 = 0b5 = 0b4 = 0b3 = 1b2 = 0b1 = 1b0 = 0
    1. 010×128 + 0×64 + 0×32 + 0×16 + 1×8 + 0×4 + 1×2 + 0×1
    2. 02= 0 + 0 + 0 + 0 + 8 + 0 + 2 + 0
    3. 03= 10

    Ready to run the numbers?

    Open Binary to Decimal Converter