How to Convert Binary to Decimal: Steps, Examples and Shortcuts
How to convert binary to decimal with two hand methods, worked examples, hex and octal shortcuts, negative numbers and code, plus a free converter.
By TheTextKit TeamPublished

Six cells for the bits 1, 0, 1, 1, 0 and 1, each above its place value 32, 16, 8, 4, 2 and 1, with the sum 32 + 8 + 4 + 1 = 45 below.
To convert binary to decimal, write the place values 1, 2, 4, 8, 16 and so on under the bits, starting at the right. Then add up the place values that sit under a 1. For 101101 that is 32 + 8 + 4 + 1, which makes 45. This guide shows how to convert binary to decimal with that method and with a second one that needs no powers. It also covers going back from decimal to binary, shortcuts for hex and octal, how negative numbers work, and what goes wrong in code with very long numbers.
How to convert binary to decimal by hand
Method 1: place values
Each position in a binary number is worth twice the position to its right. The rightmost bit is worth 1, the next 2, then 4, 8, 16 and 32. Those are the powers of two, and the rightmost one is 2^0, which is 1, not 0.
- Write the bits of the number.
- Write the place values under them, starting with 1 at the right and doubling as you move left.
- Cross out the place values under a 0.
- Add the ones that are left.
Here is 101101 worked through:
| Bit | Place value | Adds |
|---|---|---|
| 1 | 32 | 32 |
| 0 | 16 | 0 |
| 1 | 8 | 8 |
| 1 | 4 | 4 |
| 0 | 2 | 0 |
| 1 | 1 | 1 |
The total is 45. Leading zeros change nothing: 00101101 is also 45, which we checked with the converter.

Eleven tiles show the place values 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 and 1024, each double the previous tile.
Method 2: the doubling method, left to right
You can also skip the powers. Start with a total of 0. For each bit, from the left, double the total and add the bit. The Wikipedia article on binary numbers describes this as using the bits one by one, starting with the most significant. For 10110:
| Bit | Double the total, add the bit | Total |
|---|---|---|
| 1 | 0 x 2 + 1 | 1 |
| 0 | 1 x 2 + 0 | 2 |
| 1 | 2 x 2 + 1 | 5 |
| 1 | 5 x 2 + 1 | 11 |
| 0 | 11 x 2 + 0 | 22 |
So 10110 is 22. This method is handy when you read a long number aloud or type it into a program one digit at a time, because you never need to know how long it is first.
Binary to decimal examples
These are worth recognising on sight, and we checked each one with the converter:
| Binary | Decimal | Hex |
|---|---|---|
| 1 | 1 | 1 |
| 1010 | 10 | A |
| 1111 | 15 | F |
| 10000 | 16 | 10 |
| 11010110 | 214 | D6 |
| 11111111 | 255 | FF |
| 100000000 | 256 | 100 |
| 1111101000 | 1000 | 3E8 |
Two patterns help. A number of n ones is 2 to the power of n, minus 1, so eight ones is 255 and eleven ones is 2,047. A 1 followed by n zeros is exactly 2 to the power of n, so 100000000 is 256.
How to convert decimal to binary
Going the other way, divide by 2 until you reach 0 and keep every remainder. The first remainder is the rightmost bit, so you read the list from the last remainder to the first. For 357:
| Division | Quotient | Remainder |
|---|---|---|
| 357 / 2 | 178 | 1 |
| 178 / 2 | 89 | 0 |
| 89 / 2 | 44 | 1 |
| 44 / 2 | 22 | 0 |
| 22 / 2 | 11 | 0 |
| 11 / 2 | 5 | 1 |
| 5 / 2 | 2 | 1 |
| 2 / 2 | 1 | 0 |
| 1 / 2 | 0 | 1 |
Reading the remainders from the bottom gives 101100101. Check it by adding back: 256 + 64 + 32 + 4 + 1 is 357.

A table divides 357 by 2 nine times. The remainders, read from the last to the first, are 1, 0, 1, 1, 0, 0, 1, 0, 1, which spell 101100101.
Binary to hex and octal by grouping bits
Hex and octal are shorthand for binary. Because 16 is 2 to the power of 4, one hex digit is exactly four bits, and because 8 is 2 to the power of 3, one octal digit is exactly three bits. Wikipedia lists the same relationship. Group from the right and pad the left with zeros:
- 11010110 splits into 1101 and 0110, which are D and 6. So the hex value is D6, and D6 is 214.
- 11010110 split into threes is 011, 010 and 110, which are 3, 2 and 6. So the octal value is 326, and 326 in octal is also 214.
This is why Unix file modes are written in octal. The mode 755 is 111 101 101 in binary, three bits per digit. Our guide to what chmod 755 means uses it.

The bits 11010110 grouped in fours are 1101 and 0110, hex D and 6. Grouped in threes they are 011, 010 and 110, octal 3, 2 and 6.
What about negative numbers? Two's complement
Computers store negative whole numbers in two's complement. According to the Wikipedia article on two's complement, the weight of each bit is a power of two, except that the most significant bit has the negative of its power. In 8 bits the leftmost place is worth -128 instead of 128, so the range is -128 to 127.
That changes how you read the same bits:
| Bits | As unsigned | As signed 8-bit |
|---|---|---|
| 01111111 | 127 | 127 |
| 10000000 | 128 | -128 |
| 10110110 | 182 | -74 |
| 11111111 | 255 | -1 |
For 10110110 the signed sum is -128 + 32 + 16 + 4 + 2, which is -74. To negate a number, flip every bit and add 1: 74 is 01001010, flipped it is 10110101, and adding 1 gives 10110110. The same bits are 182 if you decide they are unsigned, so you always need to know which one a program means.

Eight cells show the bits 1, 0, 1, 1, 0, 1, 1, 0 above the place values -128, 64, 32, 16, 8, 4, 2 and 1. The ones add up to -74.
Binary to decimal in JavaScript and Python
Both languages convert in one call. The MDN page for parseInt says the radix can be 2 to 36, and Python's int function accepts bases 0 and 2 to 36:
// JavaScript
parseInt("101101", 2) // 45
(45).toString(2) // "101101"
# Python
int("101101", 2) # 45
bin(45) # '0b101101'
Two traps are worth knowing.
First, parseInt stops at the first digit that is not valid in the base and ignores the rest without warning. We got parseInt("1012", 2) equal to 5 and parseInt("0b101", 2) equal to 0.
Second, parseInt returns an ordinary number, and MDN warns that it can lose precision outside the safe range. We tested it. Fifty-three ones parse exactly to 9,007,199,254,740,991. Fifty-four ones come back as 18,014,398,509,481,984, but the true value is 18,014,398,509,481,983. For long numbers use BigInt("0b" + bits). Python's int gave the exact answer for 60 ones, 1,152,921,504,606,846,975, where parseInt returned 1152921504606847000.
Common mistakes when you convert binary to decimal
These are the slips that most often go wrong when people first learn how to convert binary to decimal:
- Starting the powers at 2^1. The rightmost place is 1, not 2.
- Weighting the bits from the left. The biggest place value belongs to the leftmost bit, so write the place values from the right.
- Treating text as a number. The bits 01000001 are 65 as a number but the letter A as text. Our guide to converting text to binary covers the text case.
- Forgetting whether the number is signed. 11111111 is 255 or -1.
- Dropping the leading zeros in a grouped value. Keep them while you group, then remove them at the end.
Use the Number Base Converter to check your answer
Type 101101 with the base set to binary in the Number Base Converter and it shows 45 in decimal, 2D in hex, 55 in octal and a length of 6 bits. It accepts a 0b prefix and ignores spaces and underscores inside the number. If you type a digit the base does not have, for example a 2 in a binary number, it names that digit. It reads numbers with BigInt, so 60 ones come out exactly. For a signed value, type -74 and it shows the 8-bit form B6, which is 10110110. If you work with text rather than numbers, the Text to Binary Translator does that job.
Frequently asked questions
How do you convert binary to decimal?
Write the place values 1, 2, 4, 8, 16 and so on under the bits, starting at the right. Add the place values that sit under a 1. For 101101 that is 32 + 8 + 4 + 1, which is 45.
How do you convert decimal to binary?
Divide the number by 2 again and again, writing down each remainder, until the quotient is 0. Read the remainders from last to first. For 357 they read 101100101.
What is 11111111 in decimal?
As an unsigned number it is 255, which is 2 to the power of 8 minus 1. As a signed 8-bit two's complement number the same bits mean -1, because the leftmost bit counts as -128.
How do you convert binary to hexadecimal?
Split the bits into groups of four from the right and replace each group with one hex digit. So 11010110 splits into 1101 and 0110, which is D6. For octal, use groups of three instead.
Why does JavaScript get a very long binary number wrong?
parseInt returns an ordinary number, which is only exact up to 9,007,199,254,740,991. Beyond that it rounds. Passing the digits to BigInt with a 0b prefix gives the exact value.
Convert your next binary number
Now that you know how to convert binary to decimal, pick a binary number and work it out by hand with the place values. Then confirm it in the Number Base Converter. Doing it by hand a few times is what makes numbers like 11111111 and 100000000 look familiar, and the converter is there for the long ones.


