Binary to Decimal Converter
Convert binary numbers to decimal online with this free binary-to-decimal calculator. Enter a binary number using only 0 and 1 to get its decimal value instantly, together with a step-by-step explanation.
The converter accepts ordinary binary numbers, values with a 0b prefix, and inputs containing spaces or underscores. It also supports long binary numbers of up to 512 digits.
Binary to Decimal Calculator
Enter a binary number below. For example, enter 101010 to convert it to decimal 42.
Binary to Decimal Examples
Select an example to place its binary value in the calculator. These examples include common binary-to-decimal searches and frequently used values.
How to Convert Binary to Decimal
Binary is a base-2 number system. It uses only two digits: 0 and 1. Decimal is a base-10 number system and uses the digits 0 through 9.
To convert a binary number to decimal manually, assign a power of 2 to each digit, starting with \(2^0\) at the rightmost position. Multiply each binary digit by its corresponding power of 2, then add the results.
Example: Convert 1011 from binary to decimal
| Binary digit | Position | Power of 2 | Value |
|---|---|---|---|
| 1 | 3 | 2³ = 8 | 8 |
| 0 | 2 | 2² = 4 | 0 |
| 1 | 1 | 2¹ = 2 | 2 |
| 1 | 0 | 2⁰ = 1 | 1 |
Therefore, the binary number 1011 is equal to the decimal number 11.
What Does the 0b Prefix Mean?
In many programming languages, the prefix 0b indicates that a number is written in binary notation. It is a notation prefix, not part of the binary digits themselves.
For example:
0b101010 = 101010₂ = 42₁₀This converter accepts both 101010 and 0b101010 as input and returns the same decimal result: 42.
Binary to Decimal Reference Table
This table shows the decimal equivalents of all four-bit binary numbers, from 0000 to 1111.
| Binary | Decimal | Binary | Decimal |
|---|---|---|---|
| 0000 | 0 | 1000 | 8 |
| 0001 | 1 | 1001 | 9 |
| 0010 | 2 | 1010 | 10 |
| 0011 | 3 | 1011 | 11 |
| 0100 | 4 | 1100 | 12 |
| 0101 | 5 | 1101 | 13 |
| 0110 | 6 | 1110 | 14 |
| 0111 | 7 | 1111 | 15 |
Binary Number Format and Leading Zeros
A binary number can contain leading zeros. For example, 00001001 and 1001 represent the same unsigned decimal value: 9.
Leading zeros do not change the numeric value. They can still be useful when representing fixed-width values, bytes, or computer data. The converter removes unnecessary leading zeros when displaying the calculation.
Important: This calculator interprets input as an unsigned binary number. If you need to interpret a fixed-width binary value as a signed two's-complement number, the result may be different.
Frequently Asked Questions
How do I convert binary to decimal?
Multiply each binary digit by its corresponding power of 2, starting at 2⁰ on the right. Add the resulting values to get the decimal number. You can also enter the binary number in the calculator above to get the result automatically.
What is 1011 in decimal?
The binary number 1011 equals 11 in decimal: 8 + 0 + 2 + 1 = 11.
What is 0b101010 in decimal?
The prefix 0b identifies the value as binary. 0b101010 is the same as 101010 in base 2, which equals 42 in decimal.
Can I convert a long binary number?
Yes. This converter supports binary inputs of up to 512 digits and uses decimal-string arithmetic to avoid ordinary integer overflow.
Can I use spaces or underscores in a binary number?
Yes. Spaces and underscores are removed before conversion. For example, 1010_1010 and 1010 1010 are both accepted.
Does this calculator support negative binary numbers?
The calculator treats the input as an unsigned binary number. Signed binary representations, such as two's complement, require a defined bit width and a separate interpretation.
What is the difference between binary and decimal?
Binary is base 2 and uses only 0 and 1. Decimal is base 10 and uses the digits 0 through 9. Computers use binary representations internally, while people commonly use decimal numbers in everyday calculations.
Related Number and Binary Tools
Explore these related calculators and converters for working with binary numbers, hexadecimal values, and other number systems.