Skip to content
BetterDL

Sign bit

Also called: sign digit

The most significant bit of a signed number, used to show its sign: 0 for zero or positive, 1 for negative.

A sign bit is the bit that tells you whether a signed number is negative. By convention it's the MSB: 0 means zero or positive, 1 means negative.

How the sign bit behaves depends on the format:

  • Sign-magnitude: the sign bit is only a flag, and the other bits give the size. 4-bit 1011 is −3.
  • Two's complement: the sign bit is also a real digit, with a negative weight of −2ⁿ⁻¹. 4-bit 1011 is −8 + 2 + 1 = −5.
  • Unsigned: there is no sign bit. The MSB is just the largest positive weight, and 1011 is 11.

In two's complement you can read the sign at a glance, even in hex: a leading digit of 8–F means the sign bit is 1. So 8-bit 80₁₆ is negative and 7F₁₆ is positive.

The sign bit has two more jobs in hardware. After an ALU operation it becomes the negative flag N, and in sign extension it's the bit copied into every new position on the left.

1
−8
0
4
1
2
1
1

Worked example

Example

The sign of 8-bit hex values

Check the top bit of the leading hex digit.

  1. 1.

    A7₁₆: A = 1010, so the sign bit is 1. Negative.

  2. 2.

    5C₁₆: 5 = 0101, so the sign bit is 0. Positive.

  3. 3.

    80₁₆ = 10000000: negative. It's the most negative byte, −128.

Common mistakes

  • Thinking the two's complement sign bit is only a flag. It has weight −2ⁿ⁻¹ and takes part in the value.

  • Expecting unsigned numbers to have a sign bit.

  • Writing a negative two's complement number as its size with the sign bit set. −5 in 4 bits is 1011, not 1101.

Practice Sign bit

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Sign bit is taught in Number Systems and Adders and ALUs.