2's Complement (8-bits)

2's complement is a method of represent negative numbers in binary systems.
The basis for this method stems from the question "What happens when you count down past zero?"
In a binary system, counting down past zero causes the 8-bit register to wrap around to the end, or all ones.

Using 8 bits would give us 28 possible combinations or 256.

If half of them are positive (including zero), and the other half negative, then we have a range from -128 to +127.

To convert a positive number to negative, or a negative number to positive, complement each binary bit, then increment.
Try it yourself!

 

Enter a decimal number (-128 to +127):

Note: for negative numbers, bit 7 is always set. Bit 7 isthe sign bit.