Convert binary to decimal, exact for long values, with each step written out
Paste binary and read it in decimal, with each bit times its power of two written out, and its signed value when the top bit is set.
How to use it
Paste bits. Spaces, _ and a 0b prefix are fine: 1011 0110 and 0b10110110 read the same. Read the decimal value on top and the sum by hand under it. For a signed value, pick the width in Bits: the same bits read as two’s complement show beside the unsigned value.
Examples
One byte
Input
1011 0110
Result
182
1×128 + 0×64 + 1×32 + 1×16 + 0×8 + 1×4 + 1×2 + 0×1
The same byte read as signed
Input
10110110
Result
Unsigned 182 Signed -74
Bits: 8. The top bit is set, so the signed value is 182 − 256.
How to convert binary to decimal by hand
| Place | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
Worth | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Bytes worth knowing
| Binary | Decimal | Where you meet it |
|---|---|---|
1111 1111 | 255 | the largest byte; an IPv4 octet, a color channel |
1000 0000 | 128 | the top bit of a byte; -128 when signed |
0111 1111 | 127 | the largest signed byte; the last ASCII code |
1111 1111 1111 1111 | 65,535 | the largest port number |
Questions
- Is 11111111 255 or -1?
Both, depending on how the bits are read. As an unsigned byte it is 255; as a signed 8-bit number in two’s complement it is -1. Pick 8 in Bits to see both. - Can I paste more than 64 bits?
Yes. The value is worked out exactly, up to 5,000 digits, so a 128-bit or 256-bit pattern converts to all its decimal digits. The steps by hand show for up to 32 bits. - Is the number I type uploaded?
No. Everything runs in your browser, so your numbers stay on your device. Nothing you paste is uploaded unless you share it.