dash–calculator

04 Numbers and Counting

Binary to Decimal Conversion Examples

Readout 04-0552 · Updated · Standard formula, shown below

The calculator on this page is switched off while it is checked. The formula is below, and the worked example shows how to do the sum by hand.

This page shows you how to convert binary numbers to decimal, with step-by-step examples you can follow along with. Enter any binary number (like 1011) and the calculator immediately gives you its decimal value, plus the full calculation breakdown.

Formula

The binary (base-2) number system uses only two digits, 0 and 1. Each position in a binary number represents a power of 2, starting from the rightmost digit (the least significant bit) which is 20 = 1. Moving left, each next position is 21 = 2, 22 = 4, 23 = 8, and so on.

To convert binary to decimal, you multiply each digit (0 or 1) by its corresponding power of 2, then add all the results together. In mathematical form:

Decimal = dn-1 × 2n-1 + dn-2 × 2n-2 + … + d1 × 21 + d0 × 20

Where:

  • di is the binary digit (0 or 1) at position i
  • n is the total number of digits in the binary number
  • The rightmost digit has position 0

For example, the binary number 1011 has 4 digits, so n = 4. The positions are: d3 = 1, d2 = 0, d1 = 1, d0 = 1.

Worked Example

Let’s convert the binary number 1011 (the default in the calculator) to decimal.

Step 1: Write down the binary number and label each digit with its position from right (starting at 0):

  • Position 3: 1
  • Position 2: 0
  • Position 1: 1
  • Position 0: 1

Step 2: Multiply each digit by 2 raised to its position:

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

Step 3: Add them all together: 8 + 0 + 2 + 1 = 11.

So the binary number 1011 equals decimal 11. The calculator gives the same result.

How Binary and Decimal Systems Work

Decimal (base-10) is the number system you use every day. It has ten digits (0-9), and each position represents a power of 10: ones, tens, hundreds, thousands, etc. For instance, the number 345 means 3 hundreds + 4 tens + 5 ones.

Binary (base-2) is the native language of computers. It uses only two digits, 0 and 1, because digital circuits have two states: off (0) and on (1). Each position represents a power of 2. This is why binary numbers get long quickly – the decimal number 255, for example, is 11111111 in binary (8 bits).

Converting between the two is a fundamental skill in computer science, digital electronics, and programming. Understanding it helps you grasp how data is stored, how IP addresses work, and how character encodings like ASCII represent text.

Step-by-Step Conversion Method (Doubling Method)

There’s a faster manual method called the doubling method, which works from left to right. Start with 0, then for each binary digit from left to right, double the current result and add the digit.

Let’s convert 1101 using this method:

  1. Start with 0.
  2. First digit (1): 0 × 2 + 1 = 1
  3. Second digit (1): 1 × 2 + 1 = 3
  4. Third digit (0): 3 × 2 + 0 = 6
  5. Fourth digit (1): 6 × 2 + 1 = 13

Result: 1101₂ = 13₁₀. This method is often easier for long binary numbers because you don’t have to keep track of powers of 2.

Common Mistakes and How to Avoid Them

Here are the most frequent errors people make when converting binary to decimal:

  • Starting from the wrong end: Always start with the rightmost digit as position 0. The leftmost digit is the highest power.
  • Forgetting that 0×anything = 0: A zero digit contributes nothing, but it still takes up a position. For example, in 1010, the second digit from the right is 0, but the position still exists.
  • Mixing up powers of 2: Write them out if needed: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024…
  • Using base-10 place values: Don’t think of the second digit as “tens” – it’s “twos” in binary.
  • Reading binary numbers as decimal: 1011 is not “one thousand eleven” – it’s eleven.

If you’re converting a long binary string, double-check by converting back from decimal to binary (divide by 2 repeatedly) to verify your answer.

Practical Applications of Binary to Decimal Conversion

You encounter binary-to-decimal conversion in many real-world contexts:

  • IP addresses: IPv4 addresses are four 8-bit binary numbers (e.g., 11000000.10101000.00000001.00000001 becomes 192.168.1.1).
  • Subnet masks: Used in networking to determine network and host portions.
  • ASCII codes: Each character has a binary code; converting it to decimal gives the ASCII value (e.g., 01000001 = 65 = ‘A’).
  • Memory addresses: In programming, memory addresses are often shown in hexadecimal (which is a shorthand for binary), and converting to decimal helps understand sizes.
  • Digital logic: When designing circuits, you often need to convert between binary inputs and decimal outputs.

How to Convert Decimal Back to Binary

To reverse the process, you divide the decimal number by 2 repeatedly and record the remainders. The remainders, read from bottom to top, give the binary equivalent.

Example: Convert 13 to binary.

  1. 13 ÷ 2 = 6 remainder 1
  2. 6 ÷ 2 = 3 remainder 0
  3. 3 ÷ 2 = 1 remainder 1
  4. 1 ÷ 2 = 0 remainder 1

Reading remainders from bottom to top: 1101. So 13₁₀ = 1101₂.

Limits and Notes

This calculator accepts binary numbers with up to 64 digits (bits). For longer numbers, the decimal value may exceed the maximum safe integer in JavaScript (2^53 – 1), which could cause rounding errors. For most practical purposes (IP addresses, ASCII, small numbers), 64 bits is more than enough.

Also note that binary numbers can have leading zeros (e.g., 00101). They don’t change the value – 00101 is the same as 101. The calculator handles them fine.

If you see a “Cannot compute” message, it means the binary string contains characters other than 0 and 1, or it’s empty. Make sure you enter only 0s and 1s.

Frequently Asked Questions

How do I convert binary to decimal in my head?

For short binary numbers, memorize the powers of 2 (1, 2, 4, 8, 16, 32, 64, 128) and add the ones that correspond to a 1 digit. For longer numbers, use the doubling method: start from 0, double and add each digit from left to right.

What is the decimal equivalent of 11111111?

11111111 in binary equals 255 in decimal. That’s because it’s 128+64+32+16+8+4+2+1 = 255. This is the maximum value of an 8-bit byte.

Why do computers use binary instead of decimal?

Computers use binary because digital circuits have two stable states (on/off, high/low voltage). It’s much easier and more reliable to build hardware that distinguishes between two states than ten. Binary arithmetic also maps directly to logic gates.

Can I convert a binary fraction (like 101.101) to decimal?

Yes, but this calculator only handles whole numbers. For a fraction, the digits after the point represent negative powers of 2: 2-1 = 0.5, 2-2 = 0.25, etc. So 101.101₂ = 4+1+0.5+0.125 = 5.625.

What is the largest binary number this calculator can handle?

The calculator accepts up to 64 digits. The maximum 64-bit binary number (all ones) equals 18,446,744,073,709,551,615 in decimal, but due to JavaScript’s number precision, values above 2^53 – 1 (about 9 quadrillion) may not display exactly.

Is there a shortcut for converting binary to hexadecimal?

Yes! Group binary digits in sets of four from the right, then convert each group to its hex equivalent (0-9, A-F). For example, 1101 1011 = DB in hex. This is often easier than converting to decimal directly.

Related

Formula used
in bin | Binary number | - | 1011 | 0 | 1111111111111111111111111111111111111111111111111111111111111111
out dec | Decimal value | - | bin2dec(bin) | 0

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More on this panel

The whole Numbers and Counting panel →