Skip to main content

Binary to Decimal Converter

Convert binary numbers to decimal with live step-by-step positional expansion, interactive 8-bit register toggle, two's complement, hexadecimal, and octal conversions.

Input & Mode Settings

Base 2 ↔ Base 10
8 bits detected
Integer or decimal
Sign & Width
Decimal Value (Base 10)
214
Unsigned Positive Integer
Hexadecimal (Base 16)
0xD6
Byte: 1101 0110
Octal (Base 8)
0o326
Radix 8
ASCII / UTF-8
Ö
Code 214
Formatted Binary Representation
0b 1101 0110
Length: 8 bits | Significant: 8 bits

Interactive 8-Bit Register (Click any bit to toggle 0 / 1)

MSB (Bit 7) → LSB (Bit 0)
271128
26164
25032
24116
2308
2214
2112
2001
Sum of active weights: 128 + 64 + 16 + 4 + 2 = 214 Clicking bits updates the inputs and results instantly.

Step-by-Step Positional Expansion Formula

(1 × 27) + (1 × 26) + (0 × 25) + (1 × 24) + (0 × 23) + (1 × 22) + (1 × 21) + (0 × 20)
= 128 + 64 + 0 + 16 + 0 + 4 + 2 + 0
= 214 (Base 10)
Computer Architecture Insight: In standard unsigned 8-bit representation, binary 11010110 equals decimal 214. Under signed 8-bit two's complement, the leading bit (bit 7) represents −128 instead of +128, evaluating to −128 + 64 + 16 + 4 + 2 = −42.
Bit Position Bit Digit (bi) Power of 2 (2i) Positional Weight Product Term Subtotal
Bit 7 (MSB) 1 27 128 128 128
Bit 6 1 26 64 64 192
Bit 5 0 25 32 0 192
Bit 4 1 24 16 16 208
Bit 3 0 23 8 0 208
Bit 2 1 22 4 4 212
Bit 1 1 21 2 2 214
Bit 0 (LSB) 0 20 1 0 214

Step-by-Step Binary to Decimal Conversion Guide

  1. List the Binary Digits from Left to Right: Write down your binary number. For example, 11010110. Identify the total number of digits ($n = 8$).
  2. Assign Positional Exponents: Starting from the rightmost digit (Least Significant Bit, LSB), assign powers of 2 starting at 20, 21, 22, moving leftward up to 2n−1.
  3. Multiply Each Binary Digit by Its Weight: For each bit $b_i$, compute $b_i imes 2^i$. Bits equal to 0 produce a product of 0; bits equal to 1 keep the full power-of-two value.
  4. Sum the Products: Add all product terms together to obtain the final base-10 decimal number: 128 + 64 + 0 + 16 + 0 + 4 + 2 + 0 = 214.

Interpreting Results & Common Conversion Pitfalls

Converting between binary and decimal is fundamental in computer systems, networking, and digital logic. However, several subtle representation traps cause errors in programming and hardware analysis:

  • Unsigned vs. Two's Complement Interpretation: A raw byte of binary digits like 11111111 evaluates to 255 in unsigned integer mode, but evaluates to −1 in 8-bit signed two's complement. Always confirm whether the target system interprets the leading Most Significant Bit (MSB) as a sign bit or as positive magnitude.
  • Endianness Confusion: Big-endian order places the most significant byte first (left-to-right), whereas little-endian architectures (such as x86 and ARM in standard modes) store the least significant byte at the lowest memory address. Inverting byte order produces completely incorrect numerical values.
  • Fractional Binary Rounding (Repeating Fractions): Just as $1/3$ produces an infinite repeating decimal in base 10 ($0.333\dots$), common decimal fractions like $0.1$ and $0.2$ produce repeating infinite sequences in base 2 ($0.0001100110011\dots_2$). This explains why 64-bit IEEE 754 floating-point operations in JavaScript and Python exhibit minor rounding imprecisions (e.g., 0.1 + 0.2 = 0.30000000000000004).
  • Bit-Width Truncation & Overflow: Exceeding an integer register width causes overflow. For instance, in an 8-bit unsigned integer, adding 1 to 255 (11111111) wraps around to 0 (00000000) due to carry-out bit truncation.

Quick Reference: 4-Bit Nibbles & Powers of 2

Exponent Power of 2 Value 4-Bit Binary Decimal Value Hexadecimal Octal
20 1 0000 0 0x0 0o0
21 2 0001 1 0x1 0o1
22 4 0010 2 0x2 0o2
23 8 0011 3 0x3 0o3
24 16 0100 4 0x4 0o4
25 32 0101 5 0x5 0o5
26 64 0110 6 0x6 0o6
27 128 0111 7 0x7 0o7
28 256 1000 8 0x8 0o10
210 (1 KiB) 1,024 1010 10 0xA 0o12
212 4,096 1100 12 0xC 0o14
216 (64 KiB) 65,536 1111 15 0xF 0o17

Clean Formula & Variable Key

Unsigned Binary Positional Notation Formula:
Decimal = ∑i=0n−1 (bi × 2i)
Fractional Binary Expansion Formula:
Decimal = ∑i=0n−1 (bi × 2i) + ∑j=1m (b−j × 2−j)
Signed Two's Complement Formula (n-bit width):
Decimal = (−bn−1 × 2n−1) + ∑i=0n−2 (bi × 2i)
  • bi = Binary bit at integer position i (0 or 1)
  • 2i = Positional weight corresponding to bit index i
  • n = Total number of integer bits in the sequence
  • b−j = Fractional binary bit at position j to the right of the radix point
  • 2−j = Fractional weight (0.5, 0.25, 0.125, etc.)
  • bn−1 = Most Significant Bit (MSB), which acts as the negative sign weight in two's complement

Working Example: Converting 11010110 to Decimal

Convert the 8-bit binary number 110101102 to base-10 decimal:

  • Step 1: Write Each Digit with its Index:
    Position 7: 1 | Position 6: 1 | Position 5: 0 | Position 4: 1 | Position 3: 0 | Position 2: 1 | Position 1: 1 | Position 0: 0.
  • Step 2: Calculate Each Non-Zero Positional Weight:
    1 × 27 = 128
    1 × 26 = 64
    1 × 24 = 16
    1 × 22 = 4
    1 × 21 = 2
  • Step 3: Sum the Products:
    128 + 64 + 16 + 4 + 2 = 214.
  • Step 4: Check Two's Complement Interpretation:
    If treated as a signed 8-bit signed integer: −128 + 64 + 16 + 4 + 2 = −42.

Important Technical Terms

  • Bit: The basic binary unit of digital information, representing either 0 or 1 (voltage off or on).
  • Byte: A contiguous grouping of 8 bits, capable of representing 256 distinct unsigned values (0 to 255).
  • Nibble: A 4-bit aggregation, precisely equal to one single hexadecimal digit (0x0 through 0xF).
  • Most Significant Bit (MSB): The leftmost bit carrying the highest power-of-two magnitude, or the sign bit in signed notation.
  • Least Significant Bit (LSB): The rightmost bit carrying the lowest power ($2^0 = 1$), which determines whether an integer is even or odd.
  • Radix (Base): The number of unique digits used in a numeral system (Radix 2 for binary, 8 for octal, 10 for decimal, 16 for hexadecimal).
  • Two's Complement: The standard digital logic system for expressing signed integers, where taking the bitwise NOT and adding 1 negates any number.

Frequently Asked Questions

To convert binary to decimal, write down the binary digits and assign powers of 2 from right to left starting at 2^0. Multiply each binary digit by its corresponding positional weight, then sum all the resulting values together.
Two's complement is a mathematical system used by computer architectures to represent signed integers. In an n-bit register, if the most significant bit (MSB) is 1, the number is negative, and its decimal value equals -2^(n-1) plus the remaining positive bit weights.
Yes. Digits to the right of the binary radix point represent negative powers of 2. For example, 0.1 represents 2^(-1) = 0.5, 0.01 represents 2^(-2) = 0.25, and 0.001 represents 2^(-3) = 0.125.
Standard JavaScript Number types represent integers accurately up to 2^53 - 1 (53 binary bits, or 9,007,199,254,740,991). By leveraging native BigInt implementation, arbitrary-length integer binary strings of 64 bits, 128 bits, or more can be converted without precision loss.

Methodology, Sources & Limitations

Conversion algorithms follow ANSI/IEEE 754-2019 binary floating-point specifications and ISO/IEC 10646 standard character encoding rules. Positional radix transformations utilize standard discrete mathematics and computer engineering principles.

Assumptions & Limitations: Integer operations utilize arbitrary-precision BigInt for exact calculation up to practical browser memory constraints. Fractional binary conversions use standard IEEE 754 double precision up to 53 bits of fractional mantissa. Character previews assume UTF-8/ASCII mapping for codes between 32 and 255.

✓ Copied to Clipboard!