Menu

Binary to Decimal Converter

Type a binary number and read its decimal value, with the working shown underneath. It opens on 101010, which is 42.

By Nethanel Bar, Co-founder & CEO

Last updated

Ready to actually learn to code?

Coddy teaches you by writing real code in your browser - interactive lessons, instant feedback, and AI help when you get stuck.

How to convert binary to decimal

Binary is base 2, so it has two digits, 0 and 1, and each position is worth twice the one to its right: 1, 2, 4, 8, 16, 32, 64, 128 and so on. A binary number is a list of which of those place values are switched on.

That turns the conversion into an addition. Write the place values under the bits, keep the ones that sit under a 1 and add them. 1101 has 1s under 8, 4 and 1, so it is 13. The panel under the converter does this for whatever you type.

Spaces and a 0b prefix are ignored, and the arithmetic uses BigInt, so a 64-bit number converts without rounding.

What to know about binary numbers

  • Place values double from right to left: 1, 2, 4, 8, 16, 32, 64, 128.
  • Eight bits make a byte, which holds 0 to 255.
  • A binary number that ends in 0 is even, and one that ends in 1 is odd.
  • 4 bits count up to 15, 8 bits up to 255 and 16 bits up to 65535.

Binary to decimal, worked out

Six bits: 101010

Binary

101010

Decimal

42

32 + 8 + 2 = 42. The 0s add nothing; they only hold their places.

A full byte

Binary

11111111

Decimal

255

128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255, the largest value one byte holds.

A file permission

Binary

111101101

Decimal

493

256 + 128 + 64 + 32 + 8 + 4 + 1 = 493, which is 755 in octal: the chmod 755 permission.

A power of two

Binary

10000000000

Decimal

1024

A single 1 followed by ten 0s is 2¹⁰, which is 1024.

Common binary to decimal mistakes

  • Starting the powers at 1 instead of 0. The rightmost bit is worth 2⁰, which is 1.
  • Reading the number from the wrong end. The leftmost bit carries the biggest value.
  • Adding the place values under the 0s too. Only positions that hold a 1 count.
  • Dropping leading zeros from a fixed-width value. 00001010 and 1010 are both 10, but a byte field needs all eight bits.

Binary to decimal FAQ

What is 1010 in decimal?
10. The 1s sit on the 8 and the 2, and 8 + 2 = 10.
What is 11111111 in decimal?
255. Eight 1s switch on every place value from 1 to 128: 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255.
How do I convert binary to decimal in Python?
Use int('101010', 2), which returns 42. In JavaScript, parseInt('101010', 2) does the same. You can run these conversions in the Python playground.
Is this the same as a binary translator?
No. This converts a binary number into its value. A binary translator turns text into the binary codes of its characters; for that, use the text to binary translator.

Learn more

Other developer tools

Coddy programming languages illustration

Learn to code with Coddy

GET STARTED