Binary to Decimal
Paste binary numbers, one per line. Get decimal values and the steps, signed or not. Nothing leaves your browser.
Also: All bases, Hex to Dec, Dec to Hex, Dec to Bin, Hex to Bin, Bin to Hex
- 0
- Numbers
- 0
- Max bits
- 0
- Errors
On this page
About Binary to Decimal
Updated
Binary to Decimal turns binary numbers into ordinary decimal numbers. Paste one for homework, or a list of bytes, flags or register values. Each line is converted, and a line with a wrong digit is marked at that digit.
Bits can be written in groups, like 1010 0101, with or without 0b. Set Signed when the bits are a signed byte or word, and the first bit makes the number negative.
The same tool, set up for other bases: Hex to Decimal, Decimal to Hex, Decimal to Binary, Hex to Binary, Binary to Hex, Number Base Converter.
How to use it
- Paste binary numbers, one per line, or load a file. Commas, tabs and semicolons also split a line, so a column from a spreadsheet works.
- Check From and To, next to Convert. On a phone they are under More.
- Press Convert (Alt C). Results shows every number in the To base and in decimal, hex, binary and octal. Output shows only the answers, line for line, for Copy and Download.
- Open Steps to see the math for one number, the way you would do it on paper.
- Swap (Alt S) puts the answers in the editor and turns From and To around, so you can check the way back.
- In Options: Signed for two's complement, Groups for 1111 0000 or 4,294,967,295, Prefix for 0x, 0b or 0o, and how many digits a fraction gets.
How to convert binary to decimal by hand
Write the powers of 2 over the bits, from 1 on the right. Add the powers that have a 1 under them:
Place 32 16 8 4 2 1
Bit 1 0 1 1 0 1
32 + 8 + 4 + 1 = 45A second way, good for long numbers: start at 0, and for each bit from the left, double what you have and add the bit. 1, 2, 5, 11, 22, 45.
Powers of 2
2⁰ = 1 2⁸ = 256 2¹⁶ = 65,536
2¹ = 2 2⁹ = 512 2²⁴ = 16,777,216
2² = 4 2¹⁰ = 1,024 2³² = 4,294,967,296
2³ = 8 2¹¹ = 2,048 2⁵³ = 9,007,199,254,740,992
2⁴ = 16 2¹² = 4,096 2⁶⁴ = 18,446,744,073,709,551,616
2⁵ = 32
2⁶ = 64 8 bits hold 0 to 255
2⁷ = 128 16 bits hold 0 to 65,535Negative numbers and two's complement
In a signed byte or word, a first bit of 1 makes the number negative. Set Signed to the width: at 16-bit, 1111111111111110 is -2.
How two's complement works, with a table and the method by hand.
Exact for big numbers
Masks and register values can be 64 bits long. This tool uses BigInt, so 64 ones give 18446744073709551615. A converter built on JavaScript numbers rounds them to 18446744073709552000.
Why other converters round past 2^53.
Common errors
A digit that is not 0 or 1
Binary has only two digits. A 2 means the number is not binary, or a key was hit by mistake.
10201
2 is not a binary digit. Binary uses only 0 and 1. Remove the 2,
or set From to base 3 or more.10001The letter O for a zero
Typed by hand, a capital O and a zero look the same. The tool names the letter, so you know what to type.
10O1
The letter O is not a digit. Type the digit 0 (zero) in its place.1001Two numbers on one line
Bits are often grouped in fours, as in 1111 0000. When the groups are not the same size, the tool still reads one number, 483 in decimal here, but marks the line, because it may be a list of bytes.
1111 000 11
Read as one number, 111100011. If these are separate numbers, put each
on its own line or split them with commas.1111, 000, 11A number too big for its bits
With Signed set to a width, every number must fit in it. A ninth bit does not fit in a byte.
100000000 (Signed: 8-bit)
100000000 does not fit in 8 bits. 8 bits hold up to 11111111 in binary.
Pick a wider Signed setting, or set it to Off.Binary to decimal in code and Excel
JavaScript parseInt("101101", 2) // 45
BigInt("0b" + bits) // exact at any length
Python int("101101", 2) # 45; "0b101101" works too
C strtol("101101", NULL, 2) // 45, <stdlib.h>
Java Integer.parseInt("101101", 2) // 45
new BigInteger(bits, 2) // any length
Excel =BIN2DEC("101101") → 45BIN2DEC takes up to 10 bits, and the 10th bit is the sign: =BIN2DEC("1111111111") is -1. For a longer number, split it or use the tool above.
Binary to decimal resources
- Binary number on WikipediaBase 2 from its history to how computers use it, with conversion methods worked by hand.
- Positional notation on WikipediaHow a digit's place sets its value, in any base. The idea behind every conversion on this page.
- Two's complement on WikipediaHow computers store negative whole numbers, and why the range of a signed byte is -128 to 127.
- Python: int() with a baseint("ff", 16) reads a number in any base from 2 to 36; hex(), bin() and oct() write one.
- Microsoft: BIN2DEC functionBinary to decimal in Excel, for up to 10 bits. The 10th bit carries the sign.
Binary to decimal FAQ
How do you convert binary to decimal?
Each bit counts a power of 2. From the right, the places are 1, 2, 4, 8, 16, 32 and so on. Add the places that have a 1.
For 101101: 32 + 8 + 4 + 1 = 45. Paste a number here and open Steps to see the table for yours.
How do I convert 10101 to decimal?
10101 is 21: 16 + 4 + 1. The 1s are in the places for 16, 4 and 1; the 0s count nothing.
What is 11111111 in decimal?
11111111 is 255: 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1. It is the largest number 8 bits hold. Read as a signed 8-bit number, it is -1: set Signed to 8-bit to see that.
What is 0.75 in binary?
0.75 is 0.11 in binary: half (0.5) plus a quarter (0.25). The other way works too: paste 0.11 here and you get 0.75. After the point, the places are 1/2, 1/4, 1/8 and so on.
How do I read a negative binary number?
If the number was stored in a fixed width, like a byte, it is in two's complement: a first bit of 1 makes it negative. Set Signed to that width. In 8 bits, 10000000 is -128 and 11111011 is -5.
A binary number written with a minus sign, like -101, is read as it is: -5.
Can I paste binary with spaces?
Yes. Spaces, underscores and apostrophes between digits are grouping, so 1111 0000 and 0b1111_0000 are both 240. To convert several numbers, put each on its own line or split them with commas.
Are my numbers sent anywhere?
No. The numbers are converted in your browser, with JavaScript BigInt. Nothing is uploaded, and there are no ads or cookie walls. You can check this in your browser's network tab while you use it.