FormatterHQ

Binary to Decimal Converter

Type or paste a binary number and get its decimal value right away. Handles bit strings of any length, binary fractions, negative values and the 0b prefix.

Loading tool…
Ready.

How to use the Binary to Decimal Converter

  1. Type or paste a binary number in the Binary field.
  2. Use only 0s and 1s; a leading 0b is fine, and spaces or underscores between groups are ignored.
  3. Read the decimal value in the Decimal field, which updates as you type.
  4. Copy the result for your code, spreadsheet or assignment.

Binary to decimal converter

This binary to decimal converter reads base-2 numbers and gives you their familiar base-10 values. It is useful for decoding register values, bit masks, subnet masks and exam questions, and it copes with inputs that are hundreds of bits long without losing precision.

How binary place values work

In binary, each position is a power of two. The rightmost bit is worth 1, the next 2, then 4, 8, 16 and so on. To find the decimal value, add the place values of every position that holds a 1.

Bit position76543210
Place value1286432168421
1001110010011100

For 10011100 the 1s sit at 128, 16, 8 and 4, so the value is 128 + 16 + 8 + 4 = 156.

The doubling method

For long strings there is a faster technique that avoids a table. Start at 0, then for each bit from left to right, double the running total and add the bit.

1011
start 0 → 0×2+1 = 1 → 1×2+0 = 2 → 2×2+1 = 5 → 5×2+1 = 11

This is exactly how computers parse numbers, and it works the same way for any base if you replace 2 with the base.

Binary fractions

Bits after the binary point are worth 1/2, 1/4, 1/8 and so on. The value 101.101 is therefore 4 + 1 + 0.5 + 0.125 = 5.625. Every binary fraction has a finite decimal expansion, so these results are always exact.

Example

Input          Output
1010           10
11111111       255
100000000      256
101.101        5.625
0b1101         13
-1010          -10

Input rules worth knowing

  • Spaces are ignored. If you paste grouped bits like 1010 1111 or 1010_1111, the tool reads them as one number and gives 175. To convert 1010 and 1111 separately (10 and 15), enter them one after the other.
  • Prefixes and signs: a leading 0b is accepted, and a minus sign gives a negative result.
  • Only 0 and 1 are valid. A value such as 1102 is flagged with the invalid digit highlighted, so you can spot typos quickly.
  • Unlimited length: a string of sixty-four 1s converts to exactly 18446744073709551615, with no rounding.

Unsigned vs signed values

The converter reads every bit pattern as an unsigned number, so 11111111 is always 255. In a signed 8-bit variable the same pattern means −1, because two's complement gives the top bit a negative weight of −128. When the width matters, work in the bitwise calculator, which prints both the unsigned and the signed reading of a result.

Practical uses

  • Networking: the mask 11111111.11111111.11111111.00000000 is 255.255.255.0. The binary to IP converter handles all four octets at once.
  • Hardware and embedded work: datasheets describe control registers bit by bit, and you often need the decimal value to write in code.
  • Learning: checking homework and practicing the doubling method.

For the opposite direction, use the decimal to binary converter. If you would rather have a short, readable form of the same bits, binary to hex packs every four bits into one digit.

Common mistakes

  • Starting the place values at the left. Position 0, worth 1, is always the rightmost bit of the whole number part.
  • Counting 2^8 as the value of the eighth bit. An 8-bit number uses positions 0 to 7, so its top bit is worth 128, not 256.
  • Confusing binary numbers with binary-encoded text. The string 01001000 is 72 as a number, which happens to be the ASCII code of "H".

Binary to decimal in Python

Pass the binary digits as a string to int() with base 2: int("1010", 2) returns 10. The base is the part people forget; without it, int("1010") is one thousand and ten. A 0b prefix and underscores between digits are accepted, and because Python integers have no size limit, long bit strings convert exactly. int() does not understand a binary point, though: int("101.101", 2) raises ValueError, so fractions need a few lines that add up the negative powers of two.

print(int("1010", 2))          # 10
print(int("11111111", 2))      # 255
print(int("0b100000000", 2))   # 256, the 0b prefix is accepted
print(int("1111_0000", 2))     # 240, underscores are ignored
print(0b1010)                  # 10, a binary literal is already an int

def binary_to_decimal(text):
    """Binary string with an optional fraction, e.g. 101.101"""
    whole, _, frac = text.partition(".")
    value = int(whole or "0", 2)
    for position, bit in enumerate(frac, start=1):
        value += int(bit, 2) / 2 ** position
    return value

print(binary_to_decimal("101.101"))   # 5.625

The converter above handles fractions and long values as well, which makes it a quick check on your function; decimal to binary goes the other way.

Frequently asked questions

What is 11111111 in decimal?
11111111 is 255. It is the largest unsigned 8-bit value, and it is also the value of each 255 in a subnet mask such as 255.255.255.0.
How do I convert binary with a point, like 101.101?
Give the bits after the point the weights 1/2, 1/4, 1/8 and so on. 101.101 is 4 + 1 + 0.5 + 0.125 = 5.625, which is what the converter shows.
Can I paste binary that is grouped with spaces?
Yes. Spaces, commas and underscores between groups are ignored, so 1010 1111 is read as the single value 10101111, which is 175. To convert the groups as separate numbers, enter them one at a time.
Can the converter read negative binary numbers?
It accepts a leading minus sign, so -1010 converts to -10. It does not guess a two's complement width, because the same bits mean different values in 8, 16 or 32 bits.
Is there a limit to how long the binary number can be?
No practical limit. The converter uses arbitrary-precision integers, so even 128-bit or 256-bit values convert exactly.

Last updated October 3, 2026

Related tools