Xerobit

Binary to Decimal Converter

Enter a binary string to get its decimal value immediately. This binary to decimal converter handles numbers of any length with exact precision and supports signed two's complement representation. It runs entirely in your browser without uploading data.

Treat the leading bit as a sign bit for negative numbers.

Result

  • Decimal
    10
  • Bits
    4
  • Mode
    Unsigned

How to use the binary to decimal

  1. Type or paste your binary number into the input field.
  2. Check Signed (two's complement) if the binary represents a negative number in standard computer format.
  3. Read the decimal result instantly below the input.
  4. For the reverse operation, use the decimal to binary tool.

How binary to decimal conversion works

Each digit in a binary number represents a power of 2, starting from 20 on the far right. To convert binary to decimal, multiply each bit by its positional weight and sum the results.

For example, the binary string 10110 is calculated as:

(1 x 24) + (0 x 23) + (1 x 22) + (1 x 21) + (0 x 20) = 16 + 0 + 4 + 2 + 0 = 22

This method works for any length of binary string. Because this tool uses exact BigInt arithmetic internally, it avoids the floating-point rounding errors that occur in standard calculators when processing strings longer than 53 bits.

Understanding signed two's complement

In computing, negative integers are typically stored using two's complement notation rather than a simple minus sign. When you enable the Signed option, the leftmost bit acts as the sign indicator.

If the most significant bit is 0, the number is positive and converts normally. If it is 1, the number is negative. The formula for an n-bit two's complement number where the leading bit is 1 is:

Value = Unsigned Value - 2n

For instance, the 8-bit binary 11111111 has an unsigned value of 255. Treated as signed, it becomes 255 - 256 = -1. Similarly, 10000000 evaluates to 128 - 256 = -128.

Common binary values reference

The following table lists frequently used 8-bit binary patterns alongside their unsigned and signed decimal equivalents. These boundaries are important when working with bytes in programming or networking.

BinaryUnsigned DecimalSigned Decimal
0000000000
0000000111
01111111127127
10000000128-128
11111110254-2
11111111255-1

Notice that the maximum positive signed 8-bit integer is 127, while the minimum is -128. This asymmetry is a defining characteristic of two's complement representation.

Working with other number bases

While converting binary to decimal is fundamental, developers often need to move between several bases. Binary maps directly to octal (grouping bits in threes) and hexadecimal (grouping bits in fours).

If you start with a hex string instead, convert it via the hex to binary tool first, or go straight to base 10 using the hex to decimal converter. For fractional or IEEE 754 representations, the float to binary utility handles the mantissa and exponent layout correctly.

Why exact arithmetic matters

JavaScript numbers follow the IEEE 754 double-precision standard, which safely represents integers only up to 253 - 1 (about 9 quadrillion). A 64-bit binary string exceeds this limit, meaning standard numeric parsing would silently lose precision in the lower bits.

This tool processes the input as a string and performs calculations using arbitrary-precision logic, ensuring every bit contributes accurately to the final decimal output regardless of length. Whether you are decoding a 128-bit IPv6 address segment or a 256-bit cryptographic key component, the result remains exact.

Worked examples

ExampleInputResult
Standard byteBinary number: 10101010; Signed (two's complement): noDecimal: 170; Bits: 8; Mode: Unsigned
Signed negative byteBinary number: 11111111; Signed (two's complement): yesDecimal: -1; Bits: 8; Mode: Signed (two's complement)
Large 64-bit valueBinary number: 1000000000000000000000000000000000000000000000000000000000000000; Signed (two's complement): noDecimal: 9223372036854775808; Bits: 64; Mode: Unsigned

FAQ

How do I convert binary to decimal manually?

Write down the powers of 2 above each bit from right to left, starting at 1. Multiply each bit by its corresponding power of 2, then add all the products together.

What does the signed checkbox do?

It interprets the binary string as a two's complement integer. If the leftmost bit is 1, the result will be a negative decimal number instead of a large positive one.

Is there a limit to how long the binary string can be?

No practical limit exists for this tool. It uses exact arithmetic rather than standard floating-point numbers, so strings of hundreds or thousands of bits convert accurately.

How do I convert decimal back to binary?

Use the dedicated decimal to binary tool on this site, which applies repeated division by 2 to build the binary string.

Why is my 8-bit binary number showing as negative?

You likely have the Signed option enabled. In 8-bit two's complement, any binary string starting with 1 represents a value from -128 to -1. Uncheck the box for the unsigned result.

Does this tool upload my data to a server?

No. All conversion happens locally in your browser. Nothing is transmitted over the network.