Two's Complement

Last Updated : 27 Jul, 2026

Two's complement is the standard representation of signed integers in digital systems and computer architecture. It is widely used to represent positive and negative binary numbers while simplifying binary arithmetic operations such as addition and subtraction.

  • It is obtained by taking the 1's complement of a binary number and adding 1 to the least significant bit (LSB).
  • It eliminates the two-zero representation problem, making arithmetic operations simpler and more efficient than earlier signed number representations.
2_s_complement

How to Find 2's Complement

To find the 2's complement of a binary number, follow these steps:

  1. Write the binary number.
  2. Find its 1's complement by replacing every 0 with 1 and every 1 with 0.
  3. Add 1 to the least significant bit (LSB) of the 1's complement.
  4. The resulting binary number is the 2's complement.

Examples

Example 1

Binary Number: 1010011

Step 1: Find the 1's complement.

1010011 -> 0101100

Step 2: Add 1.

0101100
+ 1
---------
0101101

2's Complement = 0101101

Example 2 (Fractional Binary Number)

Binary Number: 00111.001

Step 1: Find the 1's complement.

00111.001 -> 11000.110

Step 2: Add 1 to the least significant fractional bit.

11000.110
+ .001
-----------
11000.111

2's Complement = 11000.111

Binary Representation in 2's Complement

In 2's complement representation:

  • Positive numbers are stored in their original binary form.
  • Negative numbers are represented by finding the 2's complement of the corresponding positive binary number.

The most significant bit (MSB) acts as the sign bit:

  • 0 → Positive number
  • 1 → Negative number
image_82

Sign Extension in 2's Complement

When increasing the number of bits, the sign bit (MSB) is copied into the newly added higher-order bits. This preserves the value of both positive and negative numbers.

Decimal4-bit5-bit6-bit
+2001000010000010
+7011100111000111
-2111011110111110
-7100111001111001

Binary Addition Using 2's Complement

Binary addition in 2's complement follows the rules of ordinary binary addition. Any carry generated beyond the most significant bit (MSB) is discarded.

Number 1Number 2Result
0010 (+2)1110 (-2)0000 (0)
0111 (+7)1110 (-2)0101 (+5)
1011 (-5)0011 (+3)1110 (-2)
1111 (-1)1010 (-6)1001 (-7)

Memory Overflow Check

An overflow occurs when the result of a binary addition cannot be represented within the available number of bits.

In 2's complement, overflow occurs when:

The carry into the sign bit is different from the carry out of the sign bit.

Number 1Number 2AdditionCarry into Sign BitCarry out of Sign BitOverflow
1011 (-5)1100 (-4)(1)011101Yes
0010 (+2)0110 (+6)(0)100010Yes
0111 (+7)1110 (-2)(1)010111No
1011 (-5)0011 (+3)(0)111000No
Comment

Explore