How to convert binary to decimal

To convert a binary number to decimal, write the place values 1, 2, 4, 8, 16 and so on under the digits from right to left, then add the values that sit under a 1. 1011 is 8 + 2 + 1 = 11. This guide walks through the method with examples, shows the reverse direction, explains why programmers use hex and how negative numbers are stored. Check every example with the converter on this page.

4 min read

Place values in binary

Decimal numbers use ten digits, and each position is worth ten times the position to its right: ones, tens, hundreds. Binary works the same way with two digits, 0 and 1, so each position is worth twice the one to its right. The rightmost bit is worth 1, the next 2, then 4, 8, 16 and so on, always doubling.

Eight bits make a byte, and the place values of a byte are worth memorizing, because they appear everywhere in computing, from file sizes to network masks.

Bit position76543210
Place value1286432168421

Binary to decimal step by step

Take 11010110 as an example. Write the place values above or below the digits, starting with 1 on the right. Then add up only the place values that have a 1 under them: 128 + 64 + 16 + 4 + 2 = 214. That is the whole method, and it works for numbers of any length.

For long numbers, split the bits into groups of four from the right and convert each group separately into hex, then to decimal, or simply paste the number into the converter, which works with any length and does not round.

BinaryCalculationDecimal
1014 + 15
11118 + 4 + 2 + 115
1000003232
11010110128 + 64 + 16 + 4 + 2214
11111111128 + 64 + 32 + 16 + 8 + 4 + 2 + 1255
111111010101024 + 512 + 256 + 128 + 64 + 32 + 8 + 22026

Try it here: Binary to Decimal

Open the full tool page

Decimal to binary: divide by two

The reverse direction uses repeated division. Divide the number by 2, write down the remainder (0 or 1), and continue with the result until it reaches 0. The remainders read from the last to the first give the binary number.

For 214: 214 / 2 = 107 remainder 0, 107 / 2 = 53 remainder 1, 53 / 2 = 26 remainder 1, 26 / 2 = 13 remainder 0, 13 / 2 = 6 remainder 1, 6 / 2 = 3 remainder 0, 3 / 2 = 1 remainder 1, 1 / 2 = 0 remainder 1. Reading the remainders from the bottom up gives 11010110, the number we started with above.

Another way is to subtract the largest place value that fits: 214 minus 128 leaves 86, minus 64 leaves 22, minus 16 leaves 6, minus 4 leaves 2, minus 2 leaves 0. Write a 1 for every place value you used and a 0 for the others.

Hex: four bits per digit

Long binary numbers are hard to read, so programmers write them in hexadecimal. Hex has sixteen digits, 0 to 9 and A to F, and one hex digit stands for exactly four bits. To convert, split the binary number into groups of four from the right and replace each group using the table. 1101 0110 becomes D6, and D6 in decimal is 13 x 16 + 6 = 214.

BinaryHexDecimalBinaryHexDecimal
000000100088
000111100199
0010221010A10
0011331011B11
0100441100C12
0101551101D13
0110661110E14
0111771111F15

Negative numbers: two's complement

Computers store negative whole numbers in two's complement. The top bit of a fixed width number carries a negative weight: in 8 bits the leftmost bit is worth -128 instead of 128. So 11111111 is -128 + 127 = -1, and 10000000 is -128.

To find the pattern of a negative number, write the positive value in binary, flip every bit and add 1. For -6 in 8 bits: 6 is 00000110, flipped 11111001, plus 1 gives 11111010. The same bits read as an unsigned number are 250, which is why it matters whether a value is signed. In the converter, turn on Signed and choose the bit width to see both readings.

Binary fractions

Digits after the binary point are worth one half, one quarter, one eighth and so on. 0.101 is 0.5 + 0.125 = 0.625. Many simple decimal fractions cannot be written exactly in binary: 0.1 becomes 0.000110011001100... with 0011 repeating forever. That is the reason 0.1 + 0.2 does not give exactly 0.3 in most programming languages. The converter shows such repeating digits in brackets, for example 0.0(0011).

Step by step

  1. Choose the base of your numberSelect Binary (2) in the Base list. Prefixes like 0b are recognized, and spaces between groups are ignored.
  2. Type or paste the numberThe decimal value appears at once, together with octal, hex and a base of your choice.
  3. Check signed valuesIf the bits come from a register or a file, turn on Signed and pick the bit width to read them as two's complement.
  4. Explore the bitsClick bits in the bit view to flip them and watch how the decimal value changes.

Frequently asked questions

What is 1111 in decimal?

15. The place values are 8, 4, 2 and 1, and 8 + 4 + 2 + 1 = 15. Four ones are also the largest value a hex digit can hold, F.

How many decimal values can 8 bits hold?

256, from 0 to 255 unsigned, or from -128 to 127 as a signed two's complement number.

Why do computers use binary?

Electronic circuits can reliably tell two states apart, such as a high or low voltage. Two states map directly to the digits 1 and 0.

How do I convert binary to decimal in Excel?

Use =BIN2DEC("1011") for up to 10 bits. For longer numbers, use =DECIMAL("11010110",2) in recent versions, or the converter on this page, which has no length limit.

Is anything sent to a server when I use the converter?

No. All calculations happen in your browser.