What are two complement numbers

Two's complement

The Two's complement is used for the binary representation of negative whole numbers.

This article contains additional information and is not relevant for the lecture.


1. First, the decimal number is converted into the corresponding binary number regardless of the minus sign. If the binary number begins with a "1", it must be preceded by a "0".

2. Then the complement is formed, i.e. a "1" becomes a "0" and vice versa.

3. Finally, a 1 is added to the complement.


-9 in binary:

1. 9 as a binary number: 1001. Now a 0 is put in front: 01001

2. Complement: Off 01001 becomes 10110

3. Add 1: 10110 +1 = 10111

=> -9 = 10111


1. The first bit, also called the sign bit, has to be considered. If the first bit is set, i.e. 1, then it is a negative binary number. If it's not set, it's a positive binary number. Then steps 2 and 3 can be skipped.

2. Complement formation

3. Add 1

4. Convert binary number to decimal number

5. If the sign bit of the original number was set, a minus sign must be placed in front of the decimal number.


The number 10111 is to be converted.

1st sign bit set => It is a negative number.

2. Complement of 10111 is 01000

3. 01000 + 1 = 01001

4. 2^3+2^0 = 8 + 1 = 9

5. Set minus sign: -9


A great advantage of the two's complement is that it takes full advantage of all available bits. This is because no bit sequence is used twice. There are no +0 and -0, as in the case of the signed amount representation.

In addition, the calculation with binary numbers in two's complement is very easy. For example, instead of subtracting, negative numbers are simply added.


The disadvantage of the two's complement is the effort involved in converting.