Calcoid

Binary to Decimal Converter

Convert binary (base-2) to decimal (base-10) with hex and octal on the same screen. Supports unsigned, signed 8/16/32-bit two's complement, and fractional binary like 101.011 = 5.375, with a per-bit place-value breakdown.

Convert binary to decimal

Only 0 and 1 are accepted. Optional 0b prefix. In fractional mode a single dot (.) splits the integer and fraction halves.

Signed modes use two's complement: leading 1 flips to a negative value of -(2^N - parseInt).

Decimal value

170

Positive value across 8 bits.

Binary (normalized)

10101010

Hex

0xaa

Octal

0o252

Place-value breakdown

Every set bit contributes 2^position to the unsigned total.

  • bit 1 at position 7 = 2^7 = 128
  • bit 1 at position 5 = 2^5 = 32
  • bit 1 at position 3 = 2^3 = 8
  • bit 1 at position 1 = 2^1 = 2

Sum = 170

Frequently Asked Questions about the Binary to Decimal Converter

How does binary to decimal conversion actually work?
Binary is base-2 positional notation: every digit is worth 2 to the power of its position counted from the right, starting at 0. To convert, you add up the place values of every 1 bit. For 1010 that is 2^3 + 2^1 = 8 + 2 = 10. For 11111111 it is 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. The same rule scales to any length: the leftmost bit of an N-bit string is worth 2^(N-1), the rightmost is always worth 1.
What is two's complement and why does 11111111 sometimes mean -1?
Two's complement is how almost every CPU stores signed integers. In an N-bit signed field, if the leading bit is 1, the value is parseInt(s, 2) - 2^N. So 11111111 read as unsigned 8-bit is 255, but read as signed 8-bit it is 255 - 256 = -1. 10000000 is the most negative value, -128. The trick is that addition and subtraction work the same way for negative numbers as for positive ones with no special hardware: -1 + 1 wraps to 0 inside the 8 bits, exactly as the math demands. Choose the right width on this converter to see what your bit pattern actually encodes.
Why does bit length (8 vs 16 vs 32) change the answer?
The bit length sets two things: the maximum representable value and where the sign bit sits. An unsigned 8-bit field holds 0 to 255, signed 8-bit holds -128 to 127. Double the width and the unsigned ceiling jumps to 65,535 (16-bit) or 4,294,967,295 (32-bit), while the signed range becomes -32,768 to 32,767 or -2,147,483,648 to 2,147,483,647. The exact same bit pattern 11111111 means 255 in an 8-bit unsigned register, 255 in a 16-bit register (zero-extended on the left), and -1 only when you tell the CPU to interpret it as signed 8-bit. Width is part of the type, not part of the bits.
How do fractional binary numbers like 101.011 work?
The integer side uses positive powers of 2 and the fractional side uses negative powers. In 101.011, the fractional places are 2^-1, 2^-2, and 2^-3, so the value is 4 + 1 + 0.25 + 0.125 = 5.375. Binary floating-point formats use a significand and exponent; decimals such as 0.1 require rounding because their binary expansion repeats.
How do binary, hex, and octal line up?
Hex is shorthand for binary in groups of 4 bits, and octal is shorthand in groups of 3 bits, because 16 and 8 are both powers of 2. One hex digit always equals exactly 4 binary digits: 0xF is 1111, 0xA is 1010, so 0xFF is 11111111 = 255. One octal digit equals exactly 3 binary digits: 0o7 is 111. This is why hex is the standard way to write byte values in memory dumps, color codes (#ff5733), MAC addresses, and SHA hashes: every two hex digits is exactly one byte. The converter shows all three on every result so you can drop straight into whichever notation your tool expects.

Related Calculators

More calculators in "Tech"

See all 98 calculators in "Tech"