Two's Complement & Negative Binary

💻 Computer Science Years 10–11 Foundation

Storing negative whole numbers in a fixed byte using the two's complement system.

Open this lesson, with practice and a printable worksheet →

A computer's memory is just rows of switches: each one is a 1 or a 0, with no little minus sign to spare. So how does a byte hold -45? You cannot glue a "-" onto binary. Instead computers agree on a clever code called two's complement, where the top bit quietly does the job of the minus sign. Learn one rule — invert and add 1 — and you can flip any number positive or negative in seconds.

Why this matters: Every processor on Earth stores signed whole numbers this way. Subtraction, negative temperatures, a bank balance in the red — all of it rides on two's complement. Cambridge examiners ask you to convert both ways and to state the range, so the method has to be automatic.
8-bit two's complement place values-1286432168421sign bitthe sign bit is the only negative column; the rest are ordinary powers of two
The leftmost bit is worth -128; every other column is a normal positive place value.

Why negatives need a system

In plain (unsigned) binary, 8 bits store 0 to 255 — all positive. To fit negatives in the same 8 bits we sacrifice the top bit as a sign: if it is 1 the number is negative. Two's complement is the scheme that makes this work so that ordinary binary addition still gives the right answer.

The rule: invert and add 1

To find the negative of a number: write it in positive binary, flip every bit (0↔1), then add 1. The very same rule works in reverse to turn a negative back into a positive so you can read its size.

Denary8-bit two's complement
+1270111 1111
+10000 0001
00000 0000
-11111 1111
-451101 0011
-1281000 0000
+450010 1101invert1101 0010flip every bitadd 1+0000 0001-451101 0011check: -128+64+16+2+1 = -45
Convert-both-ways strip: invert 0010 1101, add 1, and you reach -45.

Reading a two's complement number

To read a byte whose MSB is 1, either add up the weights (remembering the top column is -128) or apply invert-and-add-1 to find its positive twin. For 1101 0011: -128 + 64 + 16 + 2 + 1 = -45.

Worked example (Calculate, 3 marks): Convert -75 to 8-bit two's complement.
Step 1 — write +75 in binary: 64+8+2+1, so 0100 1011.
Step 2 — invert every bit: 1011 0100.
Step 3 — add 1: 1011 0101.
Check: -128 + 32 + 16 + 4 + 1 = -75. Answer: 1011 0101.
Common mistake: Forgetting to add 1 after inverting. Inverting alone gives one's complement, which is wrong. Also, do not treat 1000 0000 as -0: in 8-bit two's complement it is -128, the most negative value.

Memory hook: "Flip, then tip" — flip all the bits, then tip in a 1. And the range is easy: the top value is one less than 128, so it is -128 to +127.

Get the printable worksheet →
→ Data Transmission
← Sasta Basta home All subjects