Binary to Decimal Converter
Convert base-2 binary numbers to base-10 decimal, with every step
Binary to decimal: multiply each bit by 2 raised to its position and add the results. For example, 101101₂ = 32 + 8 + 4 + 1 = 45, and 11111111₂ = 255.
How to convert binary to decimal
Binary is a positional number system with base 2. Just as each place in a decimal number is worth ten times the place to its right (ones, tens, hundreds), each place in a binary number is worth twice the place to its right: 1, 2, 4, 8, 16, 32 and so on. A binary digit, or bit, can only be 0 or 1, so every place either contributes its full value or nothing. This page reads binary into decimal; the decimal to binary converter goes the other way, and the number system converter adds octal and hexadecimal.
To convert, number the positions from 0 at the rightmost bit, multiply each bit by 2 to the power of its position, and add everything up. The only real trap is direction: position 0 is on the right, not the left. The converter above accepts any whole binary number, however long, and shows the full expansion under the result.
Step by step
- Write the binary number and label each bit with its position, starting at 0 on the right.
- Multiply each bit by 2 raised to its position (1, 2, 4, 8, 16 …).
- Add the results; bits that are 0 contribute nothing.
- Check that the total is less than 2 to the power of the number of bits.
See the place values
Worked examples
Three typical values: a small 6-bit number, a full byte, and the largest number that fits in 12 bits.
101101₂ = 1×2⁵ + 0×2⁴ + 1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 45
= 45₁₀
11001010₂ = 1×2⁷ + 1×2⁶ + 0×2⁵ + 0×2⁴ + 1×2³ + 0×2² + 1×2¹ + 0×2⁰ = 202
= 202₁₀
111111111111₂ = 1×2¹¹ + 1×2¹⁰ + 1×2⁹ + 1×2⁸ + 1×2⁷ + 1×2⁶ + 1×2⁵ + 1×2⁴ + 1×2³ + 1×2² + 1×2¹ + 1×2⁰ = 4095
= 4095₁₀
How do I convert binary to decimal in Excel or Google Sheets?
Use =BIN2DEC(A2) for up to 10 bits, or =DECIMAL(A2,2) for longer strings; with 101101 in A2, both return 45.
BIN2DEC reads its input as a 10-bit two's complement value, so =BIN2DEC("1111111111") returns −1, not 1,023, and anything longer than 10 characters returns #NUM!. DECIMAL always reads the string as unsigned and accepts far longer inputs: =DECIMAL("1111111111",2) gives 1,023, and twenty 1s give 1,048,575.
Store long binary values as text by typing an apostrophe first, because a spreadsheet keeps only 15 significant digits of an ordinary number and would silently change a 16-digit bit string. DECIMAL is available in Excel 2013 and later and in Google Sheets. In code the job is one call: int("101101", 2) in Python and parseInt("101101", 2) in JavaScript both return 45.
How do I convert a binary IP address to decimal?
Convert each 8-bit octet on its own and join the results with dots: 11000000.
An IPv4 address is one 32-bit number split into four bytes, and the dotted-decimal form simply writes each byte in base 10. Work through one octet at a time with the place values 128, 64, 32, 16, 8, 4, 2 and 1:
| Binary octet | Place values that are 1 | Decimal |
|---|---|---|
| 11000000 | 128 + 64 | 192 |
| 10101000 | 128 + 32 + 8 | 168 |
| 00000001 | 1 | 1 |
| 00000001 | 1 | 1 |
The same 32 bits read as a single number give 3,232,235,777, a form some logs and databases store instead of the dotted one. To get it, multiply the first octet by 16,777,216 (224), the second by 65,536, the third by 256, and add the fourth. Each octet can never exceed 255, so a dotted value such as 192.168.1.300 is always a typing error.
How do I convert binary to text?
Split the bits into bytes, convert each byte to decimal and look the number up in ASCII: 01001000 01101001 is 72 and 105, which spell “Hi”.
ASCII assigns the numbers 0 to 127 to letters, digits, punctuation and control codes, and UTF-8 keeps those same values for its one-byte characters, so plain English text decodes the same way in both. A few landmarks help you check your work:
| Character | Decimal | Binary |
|---|---|---|
| A | 65 | 01000001 |
| Z | 90 | 01011010 |
| a | 97 | 01100001 |
| z | 122 | 01111010 |
| 0 | 48 | 00110000 |
| space | 32 | 00100000 |
Uppercase and lowercase letters differ only in the bit worth 32, so 01000001 (A) becomes 01100001 (a). Characters outside ASCII, such as é or an emoji, take two to four bytes in UTF-8, so decode them with a proper tool rather than byte by byte. Every one of those bytes also counts toward file size, which the data storage converter scales up to kilobytes and beyond.
Binary to decimal conversion table
The first 16 binary numbers, then the boundary values that come up constantly in computing: all-ones patterns such as 1111111 (127) and 11111111 (255), and powers of two such as 10000000000 (1,024).
| Binary (base 2) | Decimal (base 10) |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 10 | 2 |
| 11 | 3 |
| 100 | 4 |
| 101 | 5 |
| 110 | 6 |
| 111 | 7 |
| 1000 | 8 |
| 1001 | 9 |
| 1010 | 10 |
| 1011 | 11 |
| 1100 | 12 |
| 1101 | 13 |
| 1110 | 14 |
| 1111 | 15 |
| 10000 | 16 |
| 11111 | 31 |
| 100000 | 32 |
| 111111 | 63 |
| 1000000 | 64 |
| 1100100 | 100 |
| 1111111 | 127 |
| 10000000 | 128 |
| 11001000 | 200 |
| 11111111 | 255 |
| 100000000 | 256 |
| 111111111 | 511 |
| 1000000000 | 512 |
| 1111101000 | 1000 |
| 1111111111 | 1023 |
| 10000000000 | 1024 |
| 100000000000 | 2048 |
| 111111111111 | 4095 |
| 1000000000000 | 4096 |
| 1111111111111111 | 65535 |
Binary vs decimal: what is the difference?
Binary and decimal are two ways of writing the same whole numbers. Only the base changes, and with it the digits, the place values and the length of each number.
| Attribute | Binary | Decimal |
|---|---|---|
| Symbol | — | — |
| System | Base 2 | Base 10 |
| Defined as | digits 0–1 | digits 0–9 |
| Digits used | 0–1 | 0–9 |
| Place values (right to left) | 1, 2, 4, 8, 16, 32 … (powers of 2) | 1, 10, 100, 1,000 … (powers of 10) |
| Written in code as | 0b101101 (Python, JavaScript, Java 7+, C++14, C23) | 45 (no prefix) |
| Digits needed for 1,000 | 10 (1111101000) | 4 |
| Used for | Hardware logic, memory, machine code, bit flags, network masks | Everyday counting, money, measurement |
| Quick parity check | Last bit 0 means even, 1 means odd | Last digit 0, 2, 4, 6 or 8 means even |
4 key differences
- A binary number needs about 3.32 times as many digits as the same value in decimal, because log₂ 10 ≈ 3.3219.
- Each binary place is worth twice the place to its right, while each decimal place is worth ten times.
- Reading binary into decimal takes only additions of powers of two; no division is involved.
- Leading zeros change neither system: 00101101₂ and 101101₂ are both 45, just as 045 and 45 are equal.
Binary place values (powers of two)
Each position is worth 2 to the power of its index, counted from 0 on the right. Memorize the first eight and you can read any byte at a glance. The row for 2³⁰ equals 1,073,741,824, the binary gigabyte explained on the MB to GB converter.
| Position | Power | Decimal value | Binary |
|---|---|---|---|
| 0 | 2⁰ | 1 | 1 |
| 1 | 2¹ | 2 | 10 |
| 2 | 2² | 4 | 100 |
| 3 | 2³ | 8 | 1000 |
| 4 | 2⁴ | 16 | 10000 |
| 5 | 2⁵ | 32 | 100000 |
| 6 | 2⁶ | 64 | 1000000 |
| 7 | 2⁷ | 128 | 10000000 |
| 8 | 2⁸ | 256 | 100000000 |
| 9 | 2⁹ | 512 | 1000000000 |
| 10 | 2¹⁰ | 1,024 | 10000000000 |
| 11 | 2¹¹ | 2,048 | 100000000000 |
| 12 | 2¹² | 4,096 | 1000000000000 |
| 13 | 2¹³ | 8,192 | 10000000000000 |
| 14 | 2¹⁴ | 16,384 | 100000000000000 |
| 15 | 2¹⁵ | 32,768 | 1000000000000000 |
| 16 | 2¹⁶ | 65,536 | 10000000000000000 |
| 20 | 2²⁰ | 1,048,576 | 1 followed by 20 zeros |
| 24 | 2²⁴ | 16,777,216 | 1 followed by 24 zeros |
| 31 | 2³¹ | 2,147,483,648 | 1 followed by 31 zeros |
| 32 | 2³² | 4,294,967,296 | 1 followed by 32 zeros |
Is there a faster way to convert binary to decimal?
Yes: the doubling method needs no table of place values. Read the bits from left to right, keep a running total, and at each step double the total and add the next bit. For 110101₂:
- 0 × 2 + 1 = 1
- 1 × 2 + 1 = 3
- 3 × 2 + 0 = 6
- 6 × 2 + 1 = 13
- 13 × 2 + 0 = 26
- 26 × 2 + 1 = 53
The final total, 53, is the decimal value. This is Horner's method, and it is how most programs parse binary strings, because it needs only one multiplication and one addition per bit.
Reading a byte through hex
For 8-bit values, split the byte into two groups of four bits, called nibbles. Each nibble is a number from 0 to 15. The byte 1101 0110 is 13 and 6, so its value is 13 × 16 + 6 = 214, which is also D6 in hexadecimal. The decimal to hex converter uses the same grouping.
Binary masks and subnet octets
Network subnet masks are runs of 1s followed by 0s. Converting the last octet from binary to decimal gives the familiar mask values, and counting the 1s gives the CIDR prefix.
| Binary octet | Decimal | Leading 1s | Example mask (prefix) |
|---|---|---|---|
| 00000000 | 0 | 0 | 255.255.255.0 (/24) |
| 10000000 | 128 | 1 | 255.255.255.128 (/25) |
| 11000000 | 192 | 2 | 255.255.255.192 (/26) |
| 11100000 | 224 | 3 | 255.255.255.224 (/27) |
| 11110000 | 240 | 4 | 255.255.255.240 (/28) |
| 11111000 | 248 | 5 | 255.255.255.248 (/29) |
| 11111100 | 252 | 6 | 255.255.255.252 (/30) |
| 11111110 | 254 | 7 | 255.255.255.254 (/31) |
| 11111111 | 255 | 8 | 255.255.255.255 (/32) |
When does 11111111 mean −1 instead of 255?
11111111 means −1 when it is read as an 8-bit signed integer in two's complement, and 255 when it is read as unsigned.
The converter reads binary as an unsigned whole number, which is the usual meaning. Many programs, however, store integers in two's complement, where the leftmost bit carries a negative weight. In an 8-bit signed value, the top bit is worth −128 instead of +128, and the other seven bits keep their normal values.
- 01111111 = 64 + 32 + 16 + 8 + 4 + 2 + 1 = 127, the largest signed byte.
- 10000000 = −128 + 0 = −128, the smallest.
- 11111111 = −128 + 127 = −1.
- 10110100 = −128 + 52 = −76, although the same bits read as unsigned are 180.
So before converting, check whether the value is meant to be signed and how many bits wide it is. The bit pattern alone does not tell you.
Common binary to decimal mistakes
- Starting positions at 1. The rightmost bit is position 0 and worth 1. Starting at 1 doubles every result.
- Counting from the left. In 1000, the 1 is worth 8, not 1.
- Reading binary as decimal. 10₂ is two and 100₂ is four. Write the base as a subscript or use the 0b prefix to avoid confusion.
- Worrying about leading zeros. 00101101 and 101101 are both 45. Leading zeros only pad a value to a fixed width, such as a full byte.
- Binary points. Bits after a binary point are worth ½, ¼, ⅛ and so on, so 101.11₂ = 5.75. This converter handles whole numbers only.
More base conversions, including octal, are on the number system converter.
Binary to decimal FAQs
Short, exact answers to what people ask most.
How do you convert binary to decimal?
Multiply each bit by 2 raised to its position, counting from 0 on the right, and add the results. For example, 11010 is 16 + 8 + 2 = 26.
What is 11111111 in decimal?
11111111 in binary is 255 in decimal. It is the largest value an unsigned 8-bit byte can hold, equal to 2 to the 8th power minus 1.
What is 1010 in decimal?
Binary 1010 is 10 in decimal: 8 + 0 + 2 + 0 = 10. In hexadecimal the same value is A.
What is 10000000 in decimal?
Binary 10000000 is 128, because the single 1 sits in position 7 and 2 to the 7th power is 128. Read as a signed 8-bit value, the same pattern is −128.
How many numbers can 8 bits represent?
Eight bits can represent 2 to the 8th power, or 256, different values. Unsigned, that is 0 to 255; in signed two's complement, it is −128 to 127.
How do you convert binary with a decimal point?
Bits to the right of the point are worth one half, one quarter, one eighth and so on. So 101.11 in binary is 4 + 1 + 0.5 + 0.25 = 5.75 in decimal.
What is 1111 in decimal?
Binary 1111 is 15 in decimal: 8 + 4 + 2 + 1. It is the largest value four bits can hold, written F in hexadecimal.
What is 101010 in decimal?
Binary 101010 equals 42 in decimal, since 32 + 8 + 2 = 42.
What is 11001000 in decimal?
11001000 in binary is 200 in decimal: 128 + 64 + 8 = 200.
What is 1111111111 in decimal?
Ten 1s in binary make 1,023 in decimal, which is 2 to the 10th power minus 1. It is the largest unsigned 10-bit value.
Related conversions
Positional notation and two's complement as described in Knuth, The Art of Computer Programming, Vol. 2 (Seminumerical Algorithms); IPv4 addressing from IETF RFC 791 and subnet notation from RFC 4632 (CIDR); ASCII from ANSI X3.4-1986 and UTF-8 from RFC 3629; BIN2DEC and DECIMAL from the Microsoft Excel and Google Sheets documentation. Last updated . How we verify our numbers.