What is Binary to Decimal Converter?
This binary to decimal converter turns base-2 numbers into ordinary base-10 integers, known as denary in UK classrooms. Each position in a binary number is a power of two, doubling from right to left (1, 2, 4, 8, 16 …), and the decimal value is the sum of the positions that hold a 1: 101101 is 32 + 8 + 4 + 1 = 45.
Paste one binary number or several separated by spaces, and each is converted instantly. For a single value, a summary shows it in every base at once, binary, octal, decimal and hex, plus the ASCII character it represents, which is handy for learning and debugging.
How to use Binary to Decimal Converter
- Enter a binary number, or several separated by spaces or commas, for example 101101
- Read the decimal result.
- For a single value, check the summary in octal, hex and ASCII.
- Copy the result, or click Swap to convert decimal to binary.
Key features
- Convert many values at once, separated by spaces or commas
- Exact results for numbers of any size, including 64-bit values
- Output separated by spaces, commas, new lines or nothing
- Uppercase or lowercase hex, optional 0x prefix, and binary padded to whole 8-bit bytes
- Swap button to reverse the conversion direction
- Summary of a single value in binary, octal, decimal, hex and ASCII
- Clear errors for invalid digits; runs entirely in your browser
Common use cases
- Learning and checking binary arithmetic for computer science classes
- Reading flag and register values in embedded systems
- Converting bytes from network captures into decimal
- Interpreting subnet masks and IP address octets
- Decoding binary values from puzzles and CTF challenges
Technical details & standards
Each bit is multiplied by 2 raised to its position, counting from 0 on the right, and the results are added: 1101 = 1×8 + 1×4 + 0×2 + 1×1 = 13. An 8-bit byte ranges from 0 (00000000) to 255 (11111111). In general, n bits hold 0 to 2ⁿ − 1, so 10 bits reach 1023 and 16 bits reach 65,535.
Values separated by spaces or commas are converted individually, and a 0b prefix is accepted. A continuous bit string is one number of any length, so 0000000100000001 gives 257; to decode bytes separately, put spaces between them (00000001 00000001 gives 1 1). The arithmetic uses arbitrary-precision integers, so 64-bit and longer values are exact, and a leading minus sign gives a negative number.
How to calculate binary to decimal: 10011101 step by step
Bin to dec is addition: write the place values over the bits and add the ones under a 1. For an 8-bit number the place values are 128, 64, 32, 16, 8, 4, 2 and 1.
- Line up the bits of 10011101 under 128, 64, 32, 16, 8, 4, 2, 1.
- The 1s fall under 128, 16, 8, 4 and 1; the 0s under 64, 32 and 2 count for nothing.
- Add the place values under the 1s: 128 + 16 + 8 + 4 + 1.
Result: 10011101 in binary is 157 in decimal (denary). Type it into the converter to see the same working with powers of two.
Binary to decimal in JavaScript and Python
Both languages parse a string of bits in one call; a 0b prefix marks a binary literal.
JavaScript
parseInt("10011101", 2); // 157
Number("0b1001"); // 9
0b11110; // 30, a binary literalPython
int("10011101", 2) # 157
int("0b1001", 0) # 9, base 0 reads the prefix
0b11110 # 30
# Signed (two's complement) value of a fixed-width bit string
def signed(bits):
n = int(bits, 2)
return n - (1 << len(bits)) if bits[0] == "1" else n
signed("11111110") # -2Binary to decimal conversion table
Every 4-bit pattern, then every 5-bit number from 10000 to 11111, so the values 0 to 31 are all here in order. The last table lists the powers of 2 up to 2¹⁶: to convert any longer binary number, add the powers for the positions that hold a 1.
4-bit binary patterns in decimal
| Binary | Decimal | Hex |
|---|---|---|
| 0000 | 0 | 0 |
| 0001 | 1 | 1 |
| 0010 | 2 | 2 |
| 0011 | 3 | 3 |
| 0100 | 4 | 4 |
| 0101 | 5 | 5 |
| 0110 | 6 | 6 |
| 0111 | 7 | 7 |
| 1000 | 8 | 8 |
| 1001 | 9 | 9 |
| 1010 | 10 | A |
| 1011 | 11 | B |
| 1100 | 12 | C |
| 1101 | 13 | D |
| 1110 | 14 | E |
| 1111 | 15 | F |
5-bit binary numbers (10000 to 11111) in decimal
| Binary | Decimal | Place values added |
|---|---|---|
| 10000 | 16 | 16 |
| 10001 | 17 | 16 + 1 |
| 10010 | 18 | 16 + 2 |
| 10011 | 19 | 16 + 2 + 1 |
| 10100 | 20 | 16 + 4 |
| 10101 | 21 | 16 + 4 + 1 |
| 10110 | 22 | 16 + 4 + 2 |
| 10111 | 23 | 16 + 4 + 2 + 1 |
| 11000 | 24 | 16 + 8 |
| 11001 | 25 | 16 + 8 + 1 |
| 11010 | 26 | 16 + 8 + 2 |
| 11011 | 27 | 16 + 8 + 2 + 1 |
| 11100 | 28 | 16 + 8 + 4 |
| 11101 | 29 | 16 + 8 + 4 + 1 |
| 11110 | 30 | 16 + 8 + 4 + 2 |
| 11111 | 31 | 16 + 8 + 4 + 2 + 1 |
Powers of 2 used in binary conversion
| Power | Decimal | Binary | Where you see it |
|---|---|---|---|
| 2⁰ | 1 | 1 | Bit 0, the rightmost position |
| 2¹ | 2 | 10 | |
| 2² | 4 | 100 | |
| 2³ | 8 | 1000 | |
| 2⁴ | 16 | 1 0000 | |
| 2⁵ | 32 | 10 0000 | |
| 2⁶ | 64 | 100 0000 | |
| 2⁷ | 128 | 1000 0000 | The leftmost bit of a byte |
| 2⁸ | 256 | 1 0000 0000 | Number of values one byte can hold |
| 2⁹ | 512 | 10 0000 0000 | |
| 2¹⁰ | 1,024 | 100 0000 0000 | 1 KiB |
| 2¹¹ | 2,048 | 1000 0000 0000 | |
| 2¹² | 4,096 | 1 0000 0000 0000 | 4 KiB, a common memory page size |
| 2¹³ | 8,192 | 10 0000 0000 0000 | |
| 2¹⁴ | 16,384 | 100 0000 0000 0000 | |
| 2¹⁵ | 32,768 | 1000 0000 0000 0000 | The leftmost bit of a 16-bit number |
| 2¹⁶ | 65,536 | 1 0000 0000 0000 0000 | Number of values 16 bits can hold |
Frequently asked questions
How do I convert binary to decimal?
Write the powers of two above the bits from right to left (1, 2, 4, 8, …) and add the ones under each 1. For 10010: 16 + 2 = 18.
What is 11111111 in decimal?
255: 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1. It is the largest value an 8-bit byte can hold.
What is 1010 in decimal?
10: 8 + 2. In binary, 1010 is the number ten.
How do I convert binary to decimal in code?
JavaScript: parseInt("101101", 2). Python: int("101101", 2). Both return 45.
What is the binary to decimal formula?
decimal = bₙ×2ⁿ + … + b₂×2² + b₁×2¹ + b₀×2⁰, where each b is a bit (0 or 1) and positions count from 0 on the right. For 1101: 1×8 + 1×4 + 0×2 + 1×1 = 13.
What is 10110 in decimal?
10110 in binary is 22 in decimal: 16 + 4 + 2 = 22.
How do I convert 11010001 to a denary value?
11010001 is 209: 128 + 64 + 16 + 1 = 209.
What is 101 in decimal?
101 is 5: 4 + 0 + 1 = 5.
What is 11110 in decimal?
11110 is 30: 16 + 8 + 4 + 2 + 0 = 30.
What is the largest 10-bit number in decimal?
1023. Ten bits all set to 1, 1111111111, add up to 512 + 256 + 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 1023, which is 2¹⁰ − 1. So 10 bits can store 1,024 different values, from 0 to 1023.
Do leading zeros change a binary number, as in 0101 or 010?
No. Leading zeros only pad the number to a fixed width, so 0101 is 101, which is 5, and 010 is 10, which is 2. They matter only when you are reading fixed-size fields such as bytes, where 00000101 tells you all eight bits.
What are 1001 and 1101 in decimal?
1001 is 8 + 1 = 9, and 1101 (sometimes written 1101₂ to show the base) is 8 + 4 + 1 = 13. Both are four bits, so each is also a single hex digit: 9 and D.
How do I convert signed binary to decimal?
Signed binary usually means two's complement: if the leftmost bit of the fixed-width value is 1, the number is negative, and its value is the unsigned value minus 2 to the power of the width. In 8 bits, 11111110 is 254 − 256 = −2 and 10000000 is −128, while 01111111 stays 127. This converter reads bits as an unsigned number, so it shows 11111110 as 254; apply the subtraction yourself, or use the snippet in the code section.