Two's Complement Calculator (Signed Binary)
Convert a signed number to two’s complement, or read a bit pattern as signed and unsigned.
Your numbers
Your results
Two's Complement Calculator (Signed Binary) by TheCalcTools
How the Two's Complement Calculator (Signed Binary) works
Two’s complement stores negative numbers as 2^width minus the magnitude, so the top bit acts as a sign. −42 in 8 bits is 256 − 42 = 214 = 11010110.
To negate a number by hand, flip all bits and add 1. The binary and hex shown include a leading 1 that marks the width; read the digits after it.
The formula
Worked example
Using the default values shown in the calculator:
| Convert | Signed decimal to two’s complement |
|---|---|
| Signed decimal | -42 |
| Binary pattern | 11010110 |
| Width | 8-bit |
- −42 in 8 bits is unsigned 214; with a marker bit the pattern is 111010110.
Result:
| Binary (two's complement) | 111010110 |
|---|---|
| Hexadecimal | 1D6 |
| Signed value | -42 |
| Unsigned value | 214 |
| Range for this width | -128 to 127 |
Frequently asked questions
Why two's complement?
Addition and subtraction work the same for signed and unsigned numbers, and there is only one zero.
Sources and further reading
Related calculators
More in AI & Computing · All calculators
This calculator gives estimates for information only. Check important results independently before you rely on them. See our disclaimer.
