Skip to content

Sign and Magnitude

Definition
In sign and magnitude, the leftmost bit indicates the sign (0 = positive, 1 = negative) and the remaining bits represent the value.
Example
8-bit sign and magnitude:
+5 = 00000101
-5 = 10000101

Problem: Two representations of zero (00000000 and 10000000)

Two's Complement

Definition
Two's complement is the standard method for representing negative numbers in binary. To negate a number: starting from the right, keep everything up to and including the first 1 the same, then flip all the remaining bits to the left.
Worked Example
Worked Example: Converting to Two's Complement

Represent -42 in 8-bit two's complement:

Step 1: Write +42 in binary
42 = 00101010

Step 2: Starting from the right, find the first 1 — keep everything from there rightward the same, flip everything to the left.
Original00101010
Actionflipflipflipflipflipflipkeepkeep
Result11010110
The first 1 from the right is at position 1 (the "10" at the end). Keep "10", flip the rest.

Answer: -42 in two's complement = 11010110
Worked Example
Worked Example: Reading Two's Complement

What decimal number does 11110011 represent?

Step 1: MSB is 1, so it's negative.

Step 2: To find the magnitude, convert back — keep everything up to and including the first 1 from the right, flip the rest.
Original11110011
Actionflipflipflipflipflipflipkeepkeep
Result00001101
00001101 = 13

Answer: 11110011 = -13
Key Point
Two's Complement Range (8-bit):
• Minimum: -128 (10000000)
• Maximum: +127 (01111111)
• One more negative number than positive!