Two's complement is the standard method computers use to represent negative integers in binary. Rather than using a separate minus sign (which hardware cannot store), two's complement repurposes the leftmost bit as a sign indicator — and, brilliantly, makes subtraction identical to addition, so the CPU needs only one arithmetic circuit.

Why can't we just add a minus sign to binary?

Think of a toggle switch: it is either on or off. There is no "minus" position. A register in the CPU stores a fixed-width pattern of 0s and 1s — nothing else. One early idea was sign-magnitude, where bit 7 acts as a + or − flag. This creates two representations of zero (00000000 and 10000000), complicates arithmetic, and wastes a circuit. Two's complement solves all three problems. It is the representation used by virtually every modern processor, including the ones running your phone and your school's computers.

What is the value of each bit in two's complement?

In an 8-bit two's complement number, the leftmost bit has a negative place value (−128) while the remaining seven bits have their usual positive values:

Bit position 7 6 5 4 3 2 1 0
Place value −128 +64 +32 +16 +8 +4 +2 +1

Example: 11110110 = −128 + 64 + 32 + 16 + 0 + 4 + 2 + 0 = −128 + 118 = −10

If bit 7 is 0, the number is non-negative; if bit 7 is 1, the number is negative. The range for 8-bit two's complement is −128 to +127.

How do you convert a positive number to its negative two's complement?

The two-step method works every time:

  1. Invert all bits (change every 0 to 1 and every 1 to 0) — this is called the one's complement.
  2. Add 1 to the result.

Worked example — convert +13 to −13 in 8 bits:

Step Binary
Start: +13 0000 1101
Step 1 — Invert all bits 1111 0010
Step 2 — Add 1 1111 0011
Result: −13 1111 0011

Verify: −128 + 64 + 32 + 16 + 0 + 0 + 2 + 1 = −128 + 115 = −13

How do you convert a negative two's complement number back to decimal?

Two approaches:

Method A (place value): Use the table above — assign −128 to bit 7 and standard values to bits 0–6. Sum all bits that are 1.

Method B (re-apply the two-step rule): Invert all bits, add 1, then read the positive number and add a minus sign.

Worked example — what is 1010 1010 in decimal?

Step Binary
Start: 1010 1010
Invert 0101 0101
Add 1 0101 0110
Read positive value = 64+16+4+2 = 86
Answer −86

Verify (Method A): −128 + 0 + 32 + 0 + 8 + 0 + 2 + 0 = −128 + 42 = −86

How does two's complement make subtraction the same as addition?

This is the elegant engineering trick at the heart of two's complement. To compute A − B, the CPU instead computes A + (−B), where −B is found using the two-step rule. The same adder circuit is reused — no separate subtractor needed.

Worked example — calculate 9 − 5 using 8-bit two's complement:

Step Binary Decimal
+9 0000 1001 9
+5 0000 0101 5
−5 (invert +5, add 1) 1111 1011 −5
Add: 9 + (−5) 0000 1001 + 1111 1011
Result (1) 0000 0100 4

The carry out of bit 7 is discarded; the 8-bit result 0000 0100 = 4 ✓ (9 − 5 = 4).

What is the range of values in two's complement?

Word size Minimum value Maximum value Total values
4-bit −8 +7 16
8-bit −128 +127 256
16-bit −32,768 +32,767 65,536
32-bit −2,147,483,648 +2,147,483,647 ~4.3 billion

The general formula: for an n-bit two's complement number, the range is −2^(n−1) to +(2^(n−1) − 1).

Frequently asked questions

Why is the minimum value one further from zero than the maximum value?

Because zero uses a positive representation (0000 0000 in 8 bits). There is only one zero in two's complement (unlike sign-magnitude), so the 256 patterns in 8 bits split as: one zero, 127 positive values, and 128 negative values. The asymmetry (−128 but only +127) exists precisely because zero sits on the positive side.

Does two's complement affect how the CPU adds positive numbers?

No. When both bit-7 values are 0, the addition proceeds identically to unsigned binary addition. The carry out of bit 7 may occur (indicating unsigned overflow), but for signed arithmetic the CPU checks whether the carry into bit 7 differs from the carry out of bit 7 — a discrepancy signals a signed overflow error.

Can you use two's complement with any number of bits?

Yes. The two-step rule (invert, add 1) works identically for 4-bit, 8-bit, 16-bit, or 64-bit numbers. The only change is the number of bits you invert and the place value of the leftmost bit. At GCSE you are typically asked to work with 8-bit examples.

What is the difference between signed and unsigned binary?

Unsigned binary treats all bits as contributing positive place values, so 8 bits represent 0–255. Signed binary (using two's complement) treats the leftmost bit as negative, giving −128 to +127 for 8 bits. The bit pattern 1111 1111 means 255 (unsigned) or −1 (signed) — the same bits, two different interpretations. The interpretation depends on the data type declared in the program.


Practise two's complement with guided worked examples from Professor Turing at aitutors.me.