A signed binary number is a binary number that can represent negative as well as positive values. Across all common signed encodings the leftmost bit () carries sign information ( for positive, for negative), but how the magnitude is encoded into the remaining bits varies between systems.

There are three standard schemes:

Comparison

For an 8-bit value, each scheme handles a few specific values:

DecimalSign-magnitude1’s complement2’s complement
000110010001100100011001
100110011110011011100111
000000000000000000000000
1000000011111111(only one zero)
011111110111111101111111
111111111000000010000001
(out of range)(out of range)10000000

Sign-and-magnitude

The cleanest mental model: leftmost bit is the sign, remaining bits are the magnitude. Has two zeros and requires sign-aware addition. Details in Sign-and-magnitude representation.

Signed 1’s complement

Negate by inverting every bit, including the sign:

  • (every bit flipped)

Range for 8 bits: to . Like sign-and-magnitude, has ( and ). Addition is “almost normal”: add the bits including the sign, then if there’s a carry out of the leftmost position, add it back into the rightmost (the end-around carry).

Signed 2’s complement

Negate by inverting every bit and adding :

Range for 8 bits: to . Asymmetric: the most negative value has no positive counterpart in 8 bits.

This is the preferred representation in almost all modern hardware. Three reasons:

  1. One zero. is the only zero, no ambiguity between and .
  2. Same addition for all sign combinations. Add the bits including the sign and discard any carry out of the most significant bit. The result is the correct 2’s complement number.
  3. Same circuits as unsigned addition. The same physical adder works for both. See 2’s Complement Arithmetic.

Negative 2’s complement to decimal

Two methods for converting a negative 2’s complement number back to decimal:

  1. Take the 2’s complement. Invert all bits and add , which gives you the magnitude. Slap a minus sign on it.

  2. Subtract the MSB’s place value. Convert as if unsigned, but the MSB contributes instead of .

Example for 8-bit :

  • Method 1: invert and add , so the original is .
  • Method 2: .

Both give .

Sign extension

To widen a signed number from bits to bits, replicate the sign bit into the new positions. The value stays the same:

That’s either way (4-bit and 8-bit 2’s complement).

For positive numbers, sign extension is just zero-padding on the left. For negative numbers in 2’s complement, it’s one-padding. The operation is so common in hardware that processor instruction sets include dedicated sign-extend instructions (SEXT, MOVSX, etc.).