Representing Negative Numbers

So far, every binary number you have worked with has been unsigned — it can only represent zero or positive values. But computers need negative numbers too. Think about bank balances, temperatures below zero, or game characters moving backwards. How can a system that only has 0s and 1s represent something like −42?

The answer is two’s complement. It is the most widely used method for representing signed (positive and negative) integers in modern computers. Nearly every processor in every phone, laptop, and server uses two’s complement, and it is a core topic in your GCSE Computer Science exam.

The idea is elegant: in an 8-bit two’s complement number, the leftmost bit (the Most Significant Bit, or MSB) acts as a sign bit:

With 8 bits, two’s complement can represent any integer from −128 to +127. That is 256 different values in total — the same count as unsigned 8-bit binary (0 to 255), but the range is shifted to include negative numbers.

Key Concept: The Sign Bit In two’s complement, the MSB is called the sign bit. It does not simply “flag” the number as negative — it actually contributes a negative place value. In an 8-bit system, the MSB has a place value of −128 (not +128). This is what makes two’s complement work so cleanly for arithmetic.

How Two’s Complement Works

The Modified Place Value Table

In unsigned binary, the place values for 8 bits are:

1286432168421

In two’s complement, the only change is that the MSB becomes negative:

−1286432168421

That single change is all it takes. The rest of the place values stay exactly the same. To read a two’s complement number, you simply add up the place values of every column that has a 1 in it — just as you always do with binary — but remember that the leftmost column is now −128.

Reading Two’s Complement Numbers

Example 1: What is 11111011 in two’s complement?

Two’s Complement — Reading 11111011
  Place values:  -128   64   32   16    8    4    2    1
  Bits:             1    1    1    1    1    0    1    1

  Calculation:  -128 + 64 + 32 + 16 + 8 + 0 + 2 + 1
              = -128 + 123
              = -5

The answer is −5. Notice that the MSB contributes −128, and all the other 1-bits add up to +123, giving a final value of −5.

More examples:

Two’s Complement — More Reading Examples
  10000000 = -128 + 0              = -128  (most negative 8-bit value)
  01111111 =    0 + 64+32+16+8+4+2+1 = +127  (most positive 8-bit value)
  11110000 = -128 + 64+32+16       = -16
  11111111 = -128 + 64+32+16+8+4+2+1 = -1
  00000000 =    0                  =  0

Converting Positive to Negative: The 3-Step Method

To convert a positive number to its negative two’s complement representation, follow these three steps:

  1. Step 1: Write the positive number in 8-bit binary.
  2. Step 2: Flip all the bits (change every 0 to 1 and every 1 to 0). This is called the one’s complement.
  3. Step 3: Add 1 to the result.

Worked Example 1: Represent −5 in two’s complement.

Converting −5 to Two’s Complement
  Step 1: Write +5 in binary:     0 0 0 0 0 1 0 1
  Step 2: Flip all bits:          1 1 1 1 1 0 1 0   (one's complement)
  Step 3: Add 1:                  1 1 1 1 1 0 1 1   (two's complement)

  -5 in two's complement = 11111011

Worked Example 2: Represent −20 in two’s complement.

Converting −20 to Two’s Complement
  Step 1: Write +20 in binary:    0 0 0 1 0 1 0 0
  Step 2: Flip all bits:          1 1 1 0 1 0 1 1   (one's complement)
  Step 3: Add 1:                  1 1 1 0 1 1 0 0   (two's complement)

  -20 in two's complement = 11101100

Worked Example 3: Represent −1 in two’s complement.

Converting −1 to Two’s Complement
  Step 1: Write +1 in binary:     0 0 0 0 0 0 0 1
  Step 2: Flip all bits:          1 1 1 1 1 1 1 0   (one's complement)
  Step 3: Add 1:                  1 1 1 1 1 1 1 1   (two's complement)

  -1 in two's complement = 11111111

This is a famous result: −1 is always represented as all 1s in two’s complement, regardless of how many bits you use.

Try This: Use the 3-step method to convert −42 and −100 to 8-bit two’s complement. Then check your answers by reading them back using the modified place value table (the −128, 64, 32, 16, 8, 4, 2, 1 method). Do you get −42 and −100 again?

Key Properties

Range of Two’s Complement

The range depends on the number of bits used. For n bits, the range is −2n−1 to +2n−1 − 1.

Number of BitsMinimum ValueMaximum ValueTotal Values
8-bit−128+127256
16-bit−32,768+32,76765,536
32-bit−2,147,483,648+2,147,483,6474,294,967,296

Notice that there is always one more negative number than there are positive numbers. For 8-bit, you can reach −128 but only +127. This asymmetry exists because zero takes up one of the “positive” slots (00000000).

Zero in Two’s Complement

Zero is simply 00000000. There is only one representation of zero in two’s complement — this is one of its key advantages over older methods like sign-and-magnitude, which had both +0 and −0.

A Number Plus Its Negative Gives Zero

If you take any number and add its two’s complement (i.e., its negative), the result is always zero (ignoring any overflow carry). For example:

5 + (−5) = 0 in Two’s Complement
    0 0 0 0 0 1 0 1     (+5)
  + 1 1 1 1 1 0 1 1     (-5)
  -----------------
  1 0 0 0 0 0 0 0 0     (9th bit is discarded)

  Result in 8 bits: 00000000 = 0

The 9th bit (the carry) is simply discarded, leaving a perfect zero. This is exactly why the method works so well.

Why Two’s Complement Is Used

The most important reason computers use two’s complement is that it simplifies the hardware. With two’s complement, the processor does not need separate circuits for addition and subtraction — the same addition circuit works for both positive and negative numbers. Subtraction is simply “add the two’s complement.” This means fewer transistors, simpler chip designs, faster calculations, and lower power consumption.

Watch Out — Common Exam Mistake: When reading a two’s complement number, students often forget that the MSB has a negative place value. If you see 10000001 and treat it as unsigned, you get 129. But in two’s complement, the correct answer is −128 + 1 = −127. Always check whether the question specifies “signed” or “two’s complement” — if it does, the MSB is negative.

Interactive Exercise 1: Two’s Complement to Denary

Convert the following 8-bit two’s complement number to its denary (decimal) value. Remember: the MSB has a place value of −128.

Loading...
Score: 0 / 0

Interactive Exercise 2: Denary to Two’s Complement

Convert the following negative denary number to its 8-bit two’s complement binary representation. Use the 3-step method: write the positive in binary, flip all bits, add 1.

Loading...
Score: 0 / 0

Test Yourself

Click on each question to reveal the answer. Try to work it out on paper first — use the place value table or the 3-step method as appropriate.

Q1: Convert the two’s complement number 11111011 to denary.

Answer:

  Place values: -128  64  32  16  8  4  2  1
  Bits:            1   1   1   1  1  0  1  1

  -128 + 64 + 32 + 16 + 8 + 2 + 1 = -5

The answer is −5.

Q2: Represent −20 in 8-bit two’s complement.

Answer:

  Step 1: +20 in binary  = 00010100
  Step 2: Flip all bits  = 11101011
  Step 3: Add 1          = 11101100

−20 in two’s complement is 11101100.

Check: −128 + 64 + 32 + 8 + 4 = −128 + 108 = −20. Correct!

Q3: What is the range of values that can be stored using 8-bit two’s complement?

Answer: The range is −128 to +127.

The formula for n bits is −2n−1 to +2n−1 − 1. For 8 bits: −27 to +27 − 1 = −128 to +127.

Q4: Why is two’s complement preferred over sign-and-magnitude for representing negative numbers?

Answer: Two’s complement is preferred for several reasons:

  • Simpler hardware: The same addition circuit can be used for both positive and negative numbers. Subtraction is just adding the two’s complement. This means fewer logic gates and simpler, cheaper processors.
  • No double zero: Sign-and-magnitude has both +0 (00000000) and −0 (10000000), which wastes a value and complicates comparisons. Two’s complement has only one zero: 00000000.
  • One extra value: Two’s complement can represent one additional negative number (−128 in 8-bit) because there is no wasted −0.
Q5: Convert the two’s complement number 10000001 to denary.

Answer:

  Place values: -128  64  32  16  8  4  2  1
  Bits:            1   0   0   0  0  0  0  1

  -128 + 1 = -127

The answer is −127. Be careful not to mistake this for +129 (which is what you would get if you treated it as unsigned binary).

Q6: What does 00000000 represent in two’s complement?

Answer: It represents zero. Since none of the bits are set, no place values are added: 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 = 0. Notice that the MSB is 0, so the sign bit indicates a non-negative number. Two’s complement has only one representation of zero, which is an advantage over sign-and-magnitude.

Q7: Represent −1 in 8-bit two’s complement.

Answer:

  Step 1: +1 in binary  = 00000001
  Step 2: Flip all bits = 11111110
  Step 3: Add 1         = 11111111

−1 in two’s complement is 11111111 — all 1s.

Check: −128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = −128 + 127 = −1. Correct!

This is a well-known result: −1 is always all 1s in two’s complement, regardless of the number of bits.

Key Vocabulary

Make sure you know all of these terms for your exam:

TermDefinition
Two’s Complement A method for representing signed (positive and negative) integers in binary, where the MSB has a negative place value. Used by virtually all modern processors.
Sign Bit The most significant bit in a signed binary number. In two’s complement, if the sign bit is 0, the number is positive (or zero); if it is 1, the number is negative.
Most Significant Bit (MSB) The leftmost bit in a binary number. In unsigned binary, the MSB has the largest positive place value. In two’s complement, the MSB has a negative place value (e.g. −128 in 8-bit).
One’s Complement The result of flipping (inverting) every bit in a binary number. It is the intermediate step when converting a positive number to its two’s complement negative form.
Signed Binary A binary representation that can express both positive and negative integers. Two’s complement is the most common signed binary system.
Unsigned Binary A binary representation that can only express zero and positive integers. All bits contribute positive place values (e.g. 128, 64, 32, 16, 8, 4, 2, 1 in 8-bit).

Exam Tips

Exam Tip 1: Memorise the 3-Step Method To convert a positive number to its negative two’s complement: (1) write the positive value in binary, (2) flip all the bits, (3) add 1. This method is quick, reliable, and easy to show working for. Examiners will expect you to show all three steps clearly — label them “Step 1,” “Step 2,” and “Step 3” to earn full method marks.
Exam Tip 2: Always Check Your Answer After converting a number to two’s complement, verify it using the place value table. Read your answer back using the −128, 64, 32, 16, 8, 4, 2, 1 place values. If you converted −20 and got 11101100, check: −128 + 64 + 32 + 8 + 4 = −20. If the check fails, you have made an error in one of the three steps. This 15-second check can save you from losing marks.
Exam Tip 3: Know the Range Formula For n-bit two’s complement, the range is −2n−1 to +2n−1 − 1. For 8-bit, that is −128 to +127. Exam questions often ask for the range or ask you to explain why a certain value cannot be stored. If you know the formula, you can answer quickly and confidently for any number of bits.
Exam Tip 4: Signed vs Unsigned Read the question carefully. If it says “unsigned binary,” the MSB is +128 and all values are positive. If it says “two’s complement” or “signed binary,” the MSB is −128 and negative values are possible. The binary pattern 10000001 could be 129 (unsigned) or −127 (two’s complement) — the interpretation depends entirely on what the question specifies.

Past Paper Questions

Try these exam-style questions, then click to reveal the mark scheme answer.

Represent the denary number -45 as an 8-bit two's complement binary number. Show your working. [3] marks

Mark scheme:

  • 45 in binary = 00101101 (1)
  • Flip all bits: 11010010 (1)
  • Add 1: 11010011 (1)
Convert the 8-bit two's complement binary number 10110100 to denary. [2] marks

Mark scheme:

  • MSB is 1 so it's negative / -128 + 32 + 16 + 4 (1)
  • Answer: -76 (1)
Explain what range of values can be represented using 8-bit two's complement. [1] mark

Mark scheme:

-128 to +127 (1)

Why Two’s Complement Matters

Two’s complement is not just an exam topic — it is the foundation of how every computer on Earth handles negative numbers. When you write temperature = -5 in Python or any other language, the processor stores that value using two’s complement. When a game character loses health points, or a bank processes a withdrawal, or a GPS calculates the direction you need to travel, two’s complement arithmetic is working behind the scenes.

The elegance of two’s complement lies in its simplicity: by making one small change (giving the MSB a negative weight), the same addition hardware works for both positive and negative numbers. This single insight, developed in the early days of computing, saved chip designers from building separate subtraction circuits and remains one of the cleverest ideas in all of computer science.

Understanding two’s complement also gives you a deeper appreciation of why computers have limits. When a 32-bit signed integer overflows past +2,147,483,647, it wraps around to −2,147,483,648 — a phenomenon that has caused real bugs in video games, financial software, and even spacecraft. Knowing how numbers are stored at the binary level makes you a better, more thoughtful programmer.

Video Resources

Further Reading