DoRevision Sign up free

Two's Complement Clinic

Store negative numbers in binary. Master the sign bit, the flip-and-add-1 method, and converting signed 8-bit numbers both ways.

⏱️ 16 min 🎯 14 activities Teachers Not yet rated Students Not yet rated

Revise this, the fun way

Play it interactively, earn XP and build a streak, free.

Start revising free

What you'll cover

Storing negatives 🔢

Plain binary can only count upward from zero, but computers need **negative** numbers too. The standard trick is **two's complement**. It stores signed whole numbers so that ordinary binary addition still works, with no special rules.

The sign bit ➖

In an 8-bit two's complement number, the **leftmost bit** (the most significant bit) is the **sign bit**: 0 means positive, 1 means negative. Its place value is **negative 128**, so the columns are -128, 64, 32, 16, 8, 4, 2, 1. An 8-bit range runs from **-128 to +127**.

Read the sign

In a two's complement number, what does a leftmost bit of 1 tell you?

  • The number is negative
  • The number is positive
  • The number is even
  • The number is very large

The biggest positive

An interactive activity.

Writing a negative 🔄

To write a negative number in two's complement, use the flip-and-add-1 method: 1. Write the **positive** value in 8-bit binary. 2. **Flip** every bit (0 becomes 1, 1 becomes 0). 3. **Add 1** to the result. For -5: +5 is 0000 0101, flip to 1111 1010, add 1 to get 1111 1011.

The flip-and-add-1 method

An interactive activity.

Encode a negative

An interactive activity.

Reading a negative 🔍

To read a two's complement number whose leftmost bit is 1, run the method **backwards**: flip every bit and add 1 to get the size, then make it negative. Or, quicker, just add up the place values remembering the leftmost column is **-128**.

Decode it

An interactive activity.

The leftmost column

In 8-bit two's complement, what is the place value of the leftmost (most significant) bit?

  • -128
  • 128
  • 255
  • -1

Why bother? 💡

Two's complement is the standard because: - There is only **one** code for **zero** (0000 0000), unlike some methods that have +0 and -0. - Ordinary **binary addition just works** for negatives, so no special subtraction hardware is needed.

True of two's complement

Select the TWO true statements about 8-bit two's complement.

  • The leftmost bit is the sign bit
  • It can represent numbers from -128 to +127
  • It has two different codes for zero
  • All eight columns are positive place values

Match each 8-bit two's complement number to its denary value

  • 0000 0001
  • 0000 0101
  • 1111 1111
  • 1111 1011
  • 1
  • 5
  • -1
  • -5

Two's complement summary

In two's complement the leftmost bit is the _____ bit, worth -128. An 8-bit range runs from -128 to +_____. To write a negative number, write the positive, _____ the bits, then add _____.

sign 127 flip 1 parity 128 keep 0