Two's Complement

Flip all bits and add 1. Visualize carry propagation and signed interpretation.

How Two's Complement Works
Step 1: Flip every bit (one's complement). Step 2: Add 1 to the result. In an 8-bit system, the range is -128 to 127. Unlike one's complement, there is only one representation of zero.
Original Binary
SIGN0
1
0
1
1
0
1
0
7
6
5
4
3
2
1
0
Step 1: Flip all bits
One's Complement
1
0
1
0
0
1
0
1
7
6
5
4
3
2
1
0
Step 2: Add 1 (carry propagation)
1
1
1
0
1
0
0
1
0
1
+
0
0
0
0
0
0
0
1

=
1
0
1
0
0
1
1
0
Result
Two's Complement
SIGN1
0
1
0
0
1
1
0
7
6
5
4
3
2
1
0
Original (decimal, 2's comp)+90
Original (unsigned)90
Two's Complement (decimal)-90
Two's Complement (unsigned)166
8-bit Two's Complement Range
-128
127

Step-by-Step Breakdown

1
Pad input to 8 bits
01011010
2
Flip every bit (one's complement)
0101101010100101
3
Add 1 to one's complement
10100101 + 1 = 10100110
4
Interpret as signed: MSB = 1 negative
10100110 = -90 in decimal
Verification: negating 90 gives -90 (90 + -90 = 0)