Cipher Utility

Binary to Decimal Converter

E-08

Binary numbers to decimal, with the place values worked out. Runs in your browser; nothing is sent anywhere.

Spaces:
Signed:
Bits:
Group:

Place values

How to convert by hand

  1. Write 1 over the rightmost bit.
  2. Double it for each bit to the left: 2, 4, 8, 16 and on.
  3. Keep the values that sit over a 1.
  4. Add them up.

Worked example

01100110 = ?

Add the values over each 1:

64 + 32 + 4 + 2

01100110 = 102

Cipher Utility reference card Catalog no. E-08

How to convert binary to decimal

Every digit in a binary number has a place value, and the place values are powers of 2. The rightmost digit is worth 1, the next one 2, then 4, 8, 16 and so on, doubling at each step to the left. To convert a binary number to decimal, add up the place values of the digits that are 1. Digits that are 0 add nothing.

bits 1 0 1 1 0 place value 16 8 4 2 1 16 + 4 + 2 = 22, so 10110 = 22

The converter above does the same addition and shows it in the place value table under the result. You can paste several numbers at once, separated by spaces or on separate lines. Each one is converted on its own, and clicking a number in the input shows its working.

Place values of binary digits

Bits are counted from the right, starting at 0. The value of bit n is 2 to the power n.

BitPowerPlace value
0201
1212
2224
3238
42416
52532
62664
727128
828256
929512
102101,024
112112,048
122124,096
132138,192
1421416,384
1521532,768
1621665,536
312312,147,483,648
322324,294,967,296
632639,223,372,036,854,775,808

The largest number that n bits can hold is one less than the next place value: 255 for 8 bits, 65,535 for 16 bits and 4,294,967,295 for 32 bits.

A faster way: double and add

For long numbers you can skip the place values. Start with 0. For each digit from left to right, double what you have and add the digit. When the digits run out, you have the answer.

1011 0 × 2 + 1 = 1 1 × 2 + 0 = 2 2 × 2 + 1 = 5 5 × 2 + 1 = 11

This works for any length, and you never need to know which power of 2 a digit stands for, so it is also handy for working in your head.

Binary numbers 0 to 15

BinaryDecimalBinaryDecimal
00000 10008
00011 10019
00102 101010
00113 101111
01004 110012
01015 110113
01106 111014
01117 111115

Four bits give exactly 16 values, which is why one hex digit stands for four bits. The binary to hex converter uses that to shorten long binary numbers.

Negative numbers: two’s complement

Computers store negative whole numbers in two’s complement. The leftmost bit gets a negative place value. In 8 bits it is worth −128 instead of 128, and every other bit keeps its usual value.

11111011 −128 + 64 + 32 + 16 + 8 + 2 + 1 = −5

Set Signed to On in the converter to read numbers this way. The width is the number of digits you type, so 11111011 is read as 8 bits and gives −5, while 011111011 is read as 9 bits and gives 251. A number that starts with 0 has the same value either way.

The bits alone cannot tell you whether 11111011 means 251 or −5. That depends on how the program that wrote them stores numbers. To go the other way, the decimal to binary converter shows how −5 becomes 11111011.

Binary fractions

Digits after a binary point have place values too. They are halves, quarters, eighths and so on.

bits 1 0 1 . 1 0 1 place value 4 2 1 0.5 0.25 0.125 4 + 1 + 0.5 + 0.125 = 5.625

Every binary fraction has an exact decimal value, and the converter prints it in full. The other direction is harder, because many decimal fractions such as 0.1 never end in binary.

When the binary is text

Binary from a puzzle or a message is often text, with each group of 8 bits standing for one character. 01001000 is 72 in decimal, and 72 is the character code for H. This page gives you the numbers. To read the letters, paste the same binary into the Binary Translator.

Questions about binary to decimal

What is 01100110 in decimal?

102. The bits that are 1 sit on the place values 64, 32, 4 and 2, and 64 + 32 + 4 + 2 = 102. Read as a character code, 102 is a lowercase f.

What is 10101 in decimal?

21. The 1 bits are worth 16, 4 and 1, and 16 + 4 + 1 = 21.

What is 11111111 in decimal?

255, the largest number that fits in 8 bits. Read as a signed 8-bit number in two's complement, the same bits mean -1.

Do leading zeros change the value?

No. 0110 and 110 are both 6. Leading zeros only matter when you read the number as signed, because then the number of digits sets the width and the first digit is the sign.

What is the largest number n bits can hold?

2 to the power n, minus 1. That is 255 for 8 bits, 65,535 for 16 bits and 4,294,967,295 for 32 bits. Signed numbers in two's complement run from -128 to 127 in 8 bits.

Is my input sent to a server?

No. The conversion runs in your browser with JavaScript, and nothing you type leaves your device.