Skip to content
AgileLogics

Binary to Decimal

Converts a base-2 (binary) number into its base-10 (decimal) equivalent.

How it works

Enter a binary number (e.g. 1010) and click Convert.

How do you convert binary to decimal?

To convert binary to decimal, multiply each bit by its place value and add the results. Place values are powers of two, starting at 1 on the right and doubling each step left: 1, 2, 4, 8, 16, 32, 64. So 1100100 is 64 + 32 + 4, which is 100 in decimal. This converter does that sum for you.

Binary is base 2, so each position can only hold a 0 or a 1. A 1 means "include this power of two" and a 0 means "skip it". Decimal works identically with powers of ten, which is why the method feels familiar once you see it laid out.

Using the converter

  1. Type or paste a binary number, for example 101101.
  2. Click Convert.
  3. Copy the decimal result.

Leading zeros are fine: 00001 gives 1. Spaces around the number are trimmed, so a value copied with a trailing newline still works. Clearing the box clears the output without an error.

Worked example: 1100100

Line up the bits with their place values:

Place value 64 32 16 8 4 2 1
Bit 1 1 0 0 1 0 0
Contributes 64 32 0 0 4 0 0

64 + 32 + 4 = 100, which matches what the tool prints.

The doubling shortcut

Writing out a table gets tedious past eight bits. A faster mental method reads the bits left to right and keeps a running total: double the total, then add the current bit. For 101011:

  • start at 0
  • bit 1: 0 × 2 + 1 = 1
  • bit 0: 1 × 2 + 0 = 2
  • bit 1: 2 × 2 + 1 = 5
  • bit 0: 5 × 2 + 0 = 10
  • bit 1: 10 × 2 + 1 = 21
  • bit 1: 21 × 2 + 1 = 43

The answer is 43, and you never had to know that the leftmost bit was worth 32. This is Horner's method, and it's also the shortest way to write a binary parser yourself.

Where you meet binary that needs decoding

The most common real case is networking. An IPv4 address is a 32-bit number (RFC 791), usually written as four decimal octets. Each octet is eight bits:

Binary octet Decimal
11000000 192
10101000 168
00000001 1
11111111 255

Convert the octets one at a time to get the dotted form 192.168.1.1. If you paste all 32 bits together, 11000000101010000000000100000001, you get 3232235777, the same address as a single integer, which is how some databases and logging tools store it. A /24 subnet mask, twenty-four 1s followed by eight 0s, comes out as 4294967040.

You'll also run into binary in permission bitmasks, hardware register docs and status flags, where each bit means something on its own. Converting to decimal gives you the number to compare against in code.

Limits and error messages

The tool parses with JavaScript's parseInt and refuses any result that isn't a safe integer. In practice:

Input Result
53 ones in a row 9007199254740991, the largest exact value
54 digits starting with 1 "That number is too large to convert precisely."
0b1010 "Enter a valid binary number..." (remove the 0b)
1010 1011 Same error; delete the space first
-101 or 10.1 Same error; signs and fractions aren't supported

Rejecting oversized values is deliberate. Past 53 bits a double-precision float can't represent every integer, so a converter that silently rounds would give you a confidently wrong answer.

Signed values need one extra step

Binary on its own has no sign. Whether 11111111 means 255 or -1 depends on whether the program treats it as unsigned or as two's complement. This tool always answers unsigned. For an n-bit signed value whose top bit is 1, subtract 2 to the power n from the result: 255 - 256 = -1 for an 8-bit byte.

Related conversions

Last updated

Frequently asked questions

How do you convert binary to decimal by hand?
Write the place values under the digits from the right (1, 2, 4, 8, 16 and so on), then add the place values that sit under a 1. For 1100100 that is 64 + 32 + 4 = 100.
What is the largest binary number this converter accepts?
Fifty-three 1s in a row, which equals 9,007,199,254,740,991 (2^53 - 1). That is the largest whole number JavaScript can hold exactly. Anything longer shows the error "That number is too large to convert precisely." instead of a rounded answer.
Can I paste binary with spaces or a 0b prefix?
No. Only the digits 0 and 1 are accepted. Spaces before and after the number are trimmed, but a space in the middle, a 0b prefix, a minus sign or a binary point all trigger the "Enter a valid binary number" error. Remove them and convert again.
Does it handle negative or two's complement binary?
No. Every input is read as an unsigned whole number, so 11111111 always gives 255, never -1. To read a signed 8-bit value, subtract 256 from the result when the leftmost bit is 1.
Is my input sent to a server?
No. The conversion runs in JavaScript on this page and nothing is uploaded.