Binary to Decimal Converter

This binary to decimal converter transforms base-2 binary numbers into base-10 decimal values. Enter any binary number to see its decimal equivalent with a step-by-step breakdown showing how each bit's place value contributes to the final result.

Binary to Decimal Converter

Convert between binary and decimal numbers instantly.

Frequently Asked Questions

How do you convert binary to decimal?

Multiply each binary digit by 2 raised to the power of its position (starting from 0 on the right). Then add all the results together. For example, binary 1011 = (1 x 2^3) + (0 x 2^2) + (1 x 2^1) + (1 x 2^0) = 8 + 0 + 2 + 1 = 11 in decimal. This positional notation method works for any length binary number.

What is the binary number system?

The binary number system (base 2) uses only two digits: 0 and 1. Each digit position represents a power of 2, just as each position in decimal represents a power of 10. Binary is the fundamental language of computers because digital circuits have two states: on (1) and off (0). All data in computers, from text to images to video, is ultimately stored and processed as binary numbers.

What is signed binary to decimal conversion?

Signed binary uses one bit (the leftmost, called the sign bit) to indicate whether the number is positive or negative. In the most common representation, two's complement, if the sign bit is 0 the number is positive and is read normally. If the sign bit is 1, the number is negative: you invert all the bits, add 1, and place a minus sign in front. For example, the 8-bit signed binary 11111001 represents -7, because inverting gives 00000110 (6) and adding 1 gives 7.

How does two's complement work?

Two's complement is the standard way computers represent negative integers. To find the two's complement of a binary number: (1) invert all bits (change 0s to 1s and vice versa), then (2) add 1 to the result. For example, to represent -5 in 8-bit two's complement: start with 5 = 00000101, invert to get 11111010, add 1 to get 11111011. To convert back: if the sign bit is 1, invert all bits and add 1. The range for an n-bit two's complement number is -2^(n-1) to 2^(n-1)-1.

How do you convert a binary fraction to decimal?

For binary digits after the radix point (binary point), multiply each bit by negative powers of 2. The first bit after the point is 2^(-1) = 0.5, the second is 2^(-2) = 0.25, the third is 2^(-3) = 0.125, and so on. For example, binary 101.11 = (1x4) + (0x2) + (1x1) + (1x0.5) + (1x0.25) = 4 + 0 + 1 + 0.5 + 0.25 = 5.75 in decimal.

What is the Double Dabble method?

Double Dabble (also called the doubling method) is a mental math shortcut for binary-to-decimal conversion. Start from the leftmost bit. Double the running total and add the current bit. Repeat for each bit. For example, 1101: start with 1, double to 2 and add 1 = 3, double to 6 and add 0 = 6, double to 12 and add 1 = 13. This avoids calculating powers of 2 and is faster for mental arithmetic.

What is the difference between binary, octal, decimal, and hexadecimal?

Binary (base 2) uses digits 0-1, octal (base 8) uses 0-7, decimal (base 10) uses 0-9, and hexadecimal (base 16) uses 0-9 and A-F. Each system represents the same values differently. Binary is native to computers, decimal is used by humans, and octal/hex serve as compact shorthands for binary since 8=2^3 and 16=2^4. For example, decimal 255 is 11111111 in binary, 377 in octal, and FF in hexadecimal.

What are LSB and MSB in binary?

LSB (Least Significant Bit) is the rightmost bit in a binary number, representing 2^0 = 1. MSB (Most Significant Bit) is the leftmost bit, representing the highest power of 2. In the binary number 10110, the LSB is 0 (rightmost) and the MSB is 1 (leftmost, representing 2^4 = 16). In signed binary, the MSB also serves as the sign bit, indicating positive (0) or negative (1).

How do you convert 8-bit binary to decimal?

For an 8-bit unsigned binary number, multiply each bit by its power of 2 (from 2^7=128 down to 2^0=1) and sum the results. For example, 10110011 = 128+0+32+16+0+0+2+1 = 179. For signed 8-bit (two's complement), if the MSB is 1, the number is negative: invert bits, add 1, and negate. The unsigned range is 0-255; the signed range is -128 to 127.

What is the largest decimal number in 8, 16, and 32 bits?

For unsigned integers: 8-bit max is 255 (2^8-1), 16-bit max is 65,535 (2^16-1), and 32-bit max is 4,294,967,295 (2^32-1). For signed two's complement: 8-bit max is 127 (2^7-1), 16-bit max is 32,767 (2^15-1), and 32-bit max is 2,147,483,647 (2^31-1). Each additional bit doubles the number of possible values.

How do you convert binary to decimal in Python and JavaScript?

In Python, use int('binary_string', 2) to convert binary to decimal. For example: int('1011', 2) returns 11. In JavaScript, use parseInt('binary_string', 2). For example: parseInt('1011', 2) returns 11. Both functions accept a string of 0s and 1s and the base (2 for binary) as arguments, returning the decimal integer value.

What is floating point binary?

Floating point binary is the IEEE 754 standard used by computers to represent real numbers (decimals). A 32-bit float uses 1 bit for sign, 8 bits for the exponent, and 23 bits for the mantissa (fraction). A 64-bit double uses 1+11+52 bits. The value equals (-1)^sign x 1.mantissa x 2^(exponent-bias). This format can represent very large and very small numbers but may have precision limitations, which is why 0.1 + 0.2 does not exactly equal 0.3 in most programming languages.

How to Convert Binary to Decimal

Converting binary to decimal uses positional notation, the same principle behind every number system. Each digit in a binary number represents a power of 2, just as each digit in a decimal number represents a power of 10. Because binary is base-2 and has only two symbols (0 and 1), each bit position doubles in value from right to left: 1, 2, 4, 8, 16, 32, 64, 128, and so on.

Step-by-Step Positional Notation Method

Step 1: Write down the binary number

Write out each binary digit. For example: 10110

Step 2: Assign powers of 2 to each bit position from right to left

Starting at position 0 (rightmost bit), label each bit with its power of 2:

Bit:10110
Power:2423222120
Value:168421

Step 3: Multiply each bit by its corresponding power of 2

  • 1 × 24 = 16
  • 0 × 23 = 0
  • 1 × 22 = 4
  • 1 × 21 = 2
  • 0 × 20 = 0

Step 4: Sum all the products to get the decimal result

16 + 0 + 4 + 2 + 0 = 22

General Formula:

Decimal = b(n) × 2n + b(n-1) × 2n-1 + ... + b(1) × 21 + b(0) × 20

Where b(i) is the binary digit at position i (either 0 or 1).

The Double Dabble Method

The Double Dabble method (also known as the doubling method) is a mental arithmetic shortcut that avoids calculating large powers of 2. Instead of multiplying each bit by its power and summing, you process the binary number from left to right using a simple rule: double the running total and add the current bit.

Double Dabble Example: 11010 to Decimal

Binary input: 11010

1. Start with the leftmost bit: 1 (running total = 1)

2. Double 1 = 2, add next bit 1 = 3

3. Double 3 = 6, add next bit 0 = 6

4. Double 6 = 12, add next bit 1 = 13

5. Double 13 = 26, add next bit 0 = 26

Result: Binary 11010 = Decimal 26

Double Dabble Example: 10110011 to Decimal

Binary input: 10110011

1. Start: 1

2. Double 1 = 2, add 0 = 2

3. Double 2 = 4, add 1 = 5

4. Double 5 = 10, add 1 = 11

5. Double 11 = 22, add 0 = 22

6. Double 22 = 44, add 0 = 44

7. Double 44 = 88, add 1 = 89

8. Double 89 = 178, add 1 = 179

Result: Binary 10110011 = Decimal 179

The Double Dabble method is particularly useful for converting long binary numbers by hand, since you never need to remember large powers of 2. It works because doubling the running total is equivalent to shifting all previous bits one position left (multiplying by 2) before adding the next bit.

Binary to Decimal Conversion Examples

Convert 1010 to Decimal

Binary input: 1010

  • 1 × 23 = 8
  • 0 × 22 = 0
  • 1 × 21 = 2
  • 0 × 20 = 0

8 + 0 + 2 + 0 = 10

Convert 11111111 to Decimal

Binary input: 11111111 (8 bits, all ones)

  • 1 × 128 = 128
  • 1 × 64 = 64
  • 1 × 32 = 32
  • 1 × 16 = 16
  • 1 × 8 = 8
  • 1 × 4 = 4
  • 1 × 2 = 2
  • 1 × 1 = 1

128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255

This is the maximum unsigned value for one byte (8 bits): 28 - 1 = 255.

Convert 10000000 to Decimal

Binary input: 10000000

Only the MSB (Most Significant Bit) is set:

1 × 27 = 128

In 8-bit signed (two's complement), this same bit pattern represents -128, the most negative 8-bit value.

Convert 1100100 to Decimal

Binary input: 1100100

  • 1 × 64 = 64
  • 1 × 32 = 32
  • 0 × 16 = 0
  • 0 × 8 = 0
  • 1 × 4 = 4
  • 0 × 2 = 0
  • 0 × 1 = 0

64 + 32 + 0 + 0 + 4 + 0 + 0 = 100

Binary to Decimal Conversion Table

This complete binary to decimal conversion table covers all 256 byte values from 0 to 255. Each row shows the decimal value, its 8-bit binary representation, hexadecimal equivalent, and octal representation.

Quick Reference (Powers of 2 & Common Values):

DecimalBinaryHexOctal
000000000000
100000001011
200000010022
400000100044
8000010000810
10000010100A12
16000100001020
32001000002040
42001010102A52
640100000040100
1000110010064144
127011111117F177
1281000000080200
25511111111FF377

This table covers all possible single-byte values (0-255) with their binary, hexadecimal, and octal equivalents. For values beyond 255, apply the same positional notation method to larger binary numbers.

Signed Binary & Two's Complement

Unsigned binary can only represent non-negative numbers. To represent negative numbers, computers use two's complement, the standard signed binary system used by virtually all modern processors.

How Two's Complement Works

In two's complement, the most significant bit (MSB) is the sign bit: 0 means positive, 1 means negative. The remaining bits hold the magnitude, but negative values are encoded by inverting all bits and adding 1.

Example: Convert 8-bit signed binary 11111001 to decimal

1. MSB is 1, so the number is negative

2. Invert all bits: 11111001 → 00000110

3. Add 1: 00000110 + 1 = 00000111 = 7

4. Apply the negative sign: -7

Two's Complement Range

BitsMinimumMaximumTotal Values
8-128127256
16-32,76832,76765,536
32-2,147,483,6482,147,483,6474,294,967,296

Binary Fractions to Decimal

Binary numbers can have a fractional part, separated by a binary point (similar to a decimal point). Bits after the binary point represent negative powers of 2: 2-1 = 0.5, 2-2 = 0.25, 2-3 = 0.125, and so on.

Example: Convert 101.11 to Decimal

Binary input: 101.11

Integer part (101):

  • 1 × 22 = 4
  • 0 × 21 = 0
  • 1 × 20 = 1

Fractional part (.11):

  • 1 × 2-1 = 0.5
  • 1 × 2-2 = 0.25

4 + 0 + 1 + 0.5 + 0.25 = 5.75

Example: Convert 1.0101 to Decimal

Binary input: 1.0101

  • 1 × 20 = 1
  • 0 × 2-1 = 0
  • 1 × 2-2 = 0.25
  • 0 × 2-3 = 0
  • 1 × 2-4 = 0.0625

1 + 0 + 0.25 + 0 + 0.0625 = 1.3125

Note: Some decimal fractions cannot be represented exactly in binary (for example, 0.1 in decimal is a repeating fraction in binary: 0.0001100110011...). This is why floating-point arithmetic can produce small rounding errors in programming.

Binary to Decimal in Programming

Most programming languages provide built-in functions for converting binary strings to decimal integers. Here are examples in the three most commonly used languages.

Python

# Convert binary string to decimal
binary_str = "10110011"
decimal_value = int(binary_str, 2)
print(decimal_value)          # 179

# Binary literal in Python
x = 0b10110011
print(x)                      # 179

# Convert decimal back to binary
print(bin(179))               # '0b10110011'

# Two's complement for signed 8-bit
def signed_binary_to_decimal(binary_str, bits=8):
    value = int(binary_str, 2)
    if value >= 2**(bits - 1):
        value -= 2**bits
    return value

print(signed_binary_to_decimal("11111001"))  # -7
print(signed_binary_to_decimal("01111111"))  # 127

JavaScript

// Convert binary string to decimal
const binaryStr = "10110011";
const decimal = parseInt(binaryStr, 2);
console.log(decimal);           // 179

// Binary literal in JavaScript
const x = 0b10110011;
console.log(x);                 // 179

// Convert decimal back to binary
console.log((179).toString(2)); // '10110011'

// For large binary values, use BigInt
const bigBin = "1111111111111111111111111111111111111111";
const bigDec = BigInt("0b" + bigBin);
console.log(bigDec.toString()); // '1099511627775'

C

#include <stdio.h>
#include <string.h>
#include <math.h>

long binaryToDecimal(const char *binary) {
    long decimal = 0;
    int len = strlen(binary);
    for (int i = 0; i < len; i++) {
        if (binary[i] == '1') {
            decimal += (long)pow(2, len - 1 - i);
        }
    }
    return decimal;
}

int main() {
    printf("%ld\n", binaryToDecimal("10110011")); // 179
    printf("%ld\n", binaryToDecimal("11111111")); // 255
    printf("%ld\n", binaryToDecimal("1100100"));  // 100

    // C also supports binary literals (C23/GCC extension)
    // int x = 0b10110011;  // 179
    return 0;
}

Applications

  • Computer architecture: Understanding how CPUs process data at the binary level and convert to human-readable decimal output
  • Networking: IP address and subnet mask calculations require binary-to-decimal conversion (e.g., subnet mask 11111111.11111111.11111111.00000000 = 255.255.255.0)
  • Digital electronics: Reading sensor outputs, ADC (Analog-to-Digital Converter) values, and logic gate states
  • Programming: Bitwise operations, bit flags, permissions, and debugging binary data
  • Data encoding: Understanding character encodings like ASCII (7-bit) and UTF-8 (variable-length binary sequences)
  • Cryptography: Binary operations underpin XOR encryption, hash functions, and block ciphers used in our Vernam cipher and other tools