Decode a binary bit pattern under all four signed conventions at once – unsigned, sign-magnitude, one’s complement and two’s complement – because the SAME bits mean different numbers under each.
Show calculation steps
Processed privately in your browser — nothing you paste is uploaded, logged or stored.
Same bits, four meanings
A register does not know whether it holds a signed number — the interpretation lives in the code that reads it. This decoder applies all four historical conventions to one pattern so the differences stop being abstract: unsigned reads the plain value; two’s complement subtracts 2ⁿ when the top bit is set; one’s complement negates by inversion; sign-magnitude splits sign flag from magnitude.
The comparison matters because mixing conventions is a real bug class: reading a two’s-complement temperature register as unsigned turns −1°C into 255°C.
Worked example
Pattern: 11010110 (8-bit) Unsigned 214 Two’s complement −42 (214 − 256) One’s complement −41 (invert → 41, negate) Sign-magnitude −86 (sign 1, magnitude 1010110)
| Pattern | Unsigned | Two’s c. | One’s c. | Sign-mag. |
|---|---|---|---|---|
| 00000000 | 0 | 0 | +0 | +0 |
| 00101010 | 42 | 42 | 42 | 42 |
| 01111111 | 127 | 127 | 127 | 127 |
| 10000000 | 128 | −128 | −127 | −0 |
| 10101010 | 170 | −86 | −85 | −42 |
| 11010101 | 213 | −43 | −42 | −85 |
| 11010110 | 214 | −42 | −41 | −86 |
| 11111111 | 255 | −1 | −0 | −127 |
How to tell which scheme applies
Documentation first, hardware conventions second: general-purpose CPU integers are two’s complement without exception today; unsigned is the default for counters, sizes and addresses; one’s complement survives in Internet checksums; sign-magnitude lives inside floating-point sign bits. When a datasheet says only “signed”, it means two’s complement in any post-1980 part.
Scope and privacy
Widths 4–64 are supported, with shorter patterns zero-padded (which the steps note, since padding can change signed readings if a set top bit was intended). Decoding is local to your browser — patterns are never transmitted.
How to use the Signed Binary to Decimal Converter
- Enter the bit pattern and choose the bit width it belongs to (4-64).
- Pick an interpretation – or "Show all four" to compare them side by side.
- Click "Decode pattern".
- The steps explain how the sign bit and remaining bits produce each value.
Frequently asked questions
Why does one bit pattern decode to four different numbers?
Because a pattern has no inherent sign convention – meaning is assigned by the scheme. 11010110 at 8 bits is 214 unsigned, −42 in two's complement, −41 in one's complement and −86 in sign-magnitude. The tool shows all four precisely to make that concrete.
How do I know which interpretation my data uses?
From context, not from the bits: CPU integer registers are two's complement, network byte counts are unsigned, IP checksums use one's-complement arithmetic, float sign bits are sign-magnitude-style. When documentation is silent on signedness, that is a red flag worth chasing.
How does the two's-complement reading work?
If the top bit is 0, read as plain binary. If 1, the value is the plain reading minus 2 to the power of the width: 11010110 reads 214, minus 256, giving −42. Equivalently: invert, add one, negate.
Why do one's complement and sign-magnitude differ from it by one-ish?
One's complement negates by pure inversion (no +1), so its negatives sit one step away from two's complement. Sign-magnitude keeps the low bits as an ordinary magnitude with a sign flag, giving a different value again – here −86 because 1010110 is 86.
What happens when the sign bit is 0?
All four schemes agree exactly – a leading 0 means the value is just the plain binary reading. Divergence only exists for patterns whose top bit is 1.
What if my pattern is shorter than the chosen width?
It is left-padded with zeros to that width, which never changes the unsigned value but CAN change signed readings if you intended the top bit set. Enter the full-width pattern when the sign bit matters.
Is the decoding done on my machine?
Yes – the schemes are applied in browser JavaScript. Patterns you paste are never transmitted or recorded.