Binary is a base-2 number system: it uses only the digits 0 and 1, and each position is worth twice the one to its right. Decimal, the system you use every day, is base 10, so each position is worth ten times the one to its right. Converting between them is a matter of knowing the place values. This guide shows two methods in each direction, a 0–15 reference table, and the shortcut through hexadecimal that programmers use.

Binary place values

In decimal, the number 345 means 3 hundreds + 4 tens + 5 ones. Binary works the same way, except the place values are powers of 2 instead of powers of 10. Counting from the rightmost digit, position 0:

Position76543210
Power of 22⁷2⁶2⁵2⁴2³2²2¹2⁰
Value1286432168421

Each binary digit is called a bit. A bit set to 1 "turns on" its place value; a bit set to 0 contributes nothing.

How to convert binary to decimal

Method 1: Add up the place values

  1. Write the binary number and label each digit with its place value, starting with 1 on the right.
  2. Cross out every place value under a 0.
  3. Add the place values under the 1s.

Example: 101101

Bit101101
Place value32168421
Counts?32–84–1

32 + 8 + 4 + 1 = 45. So binary 101101 is decimal 45.

Example: 10011010 (8 bits). The 1s sit in the 128, 16, 8 and 2 places: 128 + 16 + 8 + 2 = 154.

Method 2: Double and add (left to right)

This method is handy for long numbers because you never need to write out the place values. Start with 0. For each bit from left to right, double your running total and add the bit.

Example: 1011

Binary 1011 is decimal 11. Both methods always give the same answer; pick whichever is easier for you to do in your head.

How to convert decimal to binary

Method 1: Divide by 2 and read the remainders

  1. Divide the decimal number by 2. Write down the whole-number quotient and the remainder (0 or 1).
  2. Divide the quotient by 2 again, and keep going until the quotient is 0.
  3. Read the remainders from the bottom up. That's your binary number.

Example: convert 156 to binary

DivisionQuotientRemainder
156 ÷ 2780
78 ÷ 2390
39 ÷ 2191
19 ÷ 291
9 ÷ 241
4 ÷ 220
2 ÷ 210
1 ÷ 201

Reading the remainders from the last row to the first gives 10011100. Check it with place values: 128 + 16 + 8 + 4 = 156. ✓

The most common mistake is reading the remainders top-down, which gives 00111001. That's the number backwards. The first remainder is the ones bit, so it belongs on the right.

Method 2: Subtract the largest power of 2

  1. Find the largest power of 2 that fits into your number. Put a 1 in that position.
  2. Subtract it, then repeat with what's left.
  3. Put 0s in every position you skipped.

Example: convert 45 to binary. The largest power of 2 that fits is 32 (64 is too big). 45 − 32 = 13. Next, 8 fits: 13 − 8 = 5. Then 4: 5 − 4 = 1. Then 1: 1 − 1 = 0. You used 32, 8, 4 and 1, and skipped 16 and 2, so the bits for 32-16-8-4-2-1 are 101101. That's the same pair as the first binary-to-decimal example, worked in the other direction.

Check your work instantly

Paste a binary number to see its decimal value with the steps shown.

Binary to Decimal Converter →

Binary to decimal table: 0–15

These 16 values are worth memorizing, because every group of four bits maps to exactly one of them. The hexadecimal column is included because it's the shortcut covered in the next section.

DecimalBinary (4-bit)Hex
000000
100011
200102
300113
401004
501015
601106
701117
810008
910019
101010A
111011B
121100C
131101D
141110E
151111F

Leading zeros don't change the value: 0101 and 101 are both 5. They're written here so every entry is four bits wide.

The hexadecimal shortcut

Because 16 = 2⁴, every hex digit stands for exactly four bits. To convert a long binary number, split it into groups of four starting from the right, swap each group for its hex digit using the table above, then convert the hex to decimal.

Example: 10011010 splits into 1001 and 1010, which are 9 and A. So the number is 9A in hex, and 9 × 16 + 10 = 154, matching the place-value result earlier. If the leftmost group is short, pad it with zeros on the left: 101101 becomes 0010 1101 = 2D = 2 × 16 + 13 = 45. For more on base 16, try the Hex to Decimal Converter.

Numbers worth knowing

BitsDifferent valuesLargest unsigned value
41615 (1111)
8 (one byte)256255 (11111111)
101,0241,023
1665,53665,535

With n bits you can write 2ⁿ different values, from 0 up to 2ⁿ − 1. That's why a byte tops out at 255, a number you'll see in RGB color values and IP addresses.

Two special cases

Binary fractions

Digits after a binary point continue the pattern downward: ½, ¼, ⅛ and so on. Binary 0.101 is ½ + ⅛ = 0.5 + 0.125 = 0.625. Some decimal fractions, like 0.1, have no exact binary form, which is why computers sometimes show tiny rounding differences.

Negative numbers (two's complement)

Computers usually store signed integers in two's complement. In 8 bits, the pattern 11111111 means 255 if the value is unsigned but −1 if it's signed, and −5 is stored as 11111011. A plain binary-to-decimal converter assumes unsigned values, so if you're reading memory or network data, check which interpretation the format uses.

Quick recap

If you work with binary as a developer, Unix time explained covers another number format computers store in bits, and browser-based developer tools rounds up more converters worth bookmarking.

Frequently asked questions

What is 1010 in decimal?

Binary 1010 is decimal 10. The 1s sit in the 8 and 2 places, and 8 + 2 = 10.

How do you convert 255 to binary?

255 is 11111111 in binary. It equals 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1, the largest value that fits in 8 bits.

Why do you read the remainders from the bottom up?

The first division by 2 gives the remainder for the ones place, which is the rightmost bit. Each later division gives the next place to the left, so the last remainder is the leftmost bit.

How many values can 8 bits hold?

8 bits can hold 2⁸ = 256 different values. As unsigned numbers that is 0 to 255; in two's complement signed form it is −128 to 127.

How do you convert a binary fraction like 0.101?

Digits after the binary point are worth ½, ¼, ⅛ and so on. Binary 0.101 is 0.5 + 0.125 = 0.625 in decimal.

Related tools