# What’s difference between 1’s Complement and 2’s Complement?

**1’s complement** of a binary number is another binary number obtained by toggling all bits in it, i.e., transforming the 0 bit to 1 and the 1 bit to 0.

Examples:

Let numbers be stored using 4 bits 1's complement of 7 (0111) is 8 (1000) 1's complement of 12 (1100) is 3 (0011)

**2’s complement** of a binary number is 1 added to the 1’s complement of the binary number.

Examples:

Let numbers be stored using 4 bits 2's complement of 7 (0111) is 9 (1001) 2's complement of 12 (1100) is 4 (0100)

These representations are used for signed numbers.

The** main difference** between 1′ s complement and 2′ s complement is that 1′ s complement has two representations of 0 (zero) – 00000000, which is positive zero (+0) and 11111111, which is negative zero (-0); whereas in 2′ s complement, there is only one representation for zero – 00000000 (+0) because if we add 1 to 11111111 (-1), we get 00000000 (+0) which is the same as positive zero. This is the reason why 2′ s complement is generally used.

Another difference is that while adding numbers using 1′ s complement, we first do binary addition, then add in an end-around carry value. But, 2′ s complement has only one value for zero, and doesn’t require carry values.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above

Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: **DSA Self Paced**. Become industry ready at a student-friendly price.

## Recommended Posts:

- Difference between Signed magnitude and 2's complement
- 10's Complement of a decimal number
- Subtraction of two numbers using 2's Complement
- 1's and 2's complement of a Binary Number
- Previous number same as 1's complement
- Complement of a number with any base b
- Find One's Complement of an Integer
- 9's complement of a decimal number
- Check if one of the numbers is one's complement of the other
- Why are negative numbers stored as 2's complement?
- 8085 program to find 1's and 2's complement of 8-bit number
- Efficient method for 2's complement of a binary string
- 8085 program to find 1’s and 2’s complement of 16-bit number
- Find relative complement of two sorted arrays
- Check if bits in range L to R of two numbers are complement of each other or not
- Interface 8255 with 8085 microprocessor for 1’s and 2’s complement of a number
- Check if binary representation of a given number and its complement are anagram
- 8085 program to find 2's complement of the contents of Flag Register
- Difference between SDN and NFV
- Difference between CPU and GPU