Two's Complement

Learn the representation of signed numbers in binary using two's complement.

What is two’s complement?

Two’s complement is the most widely used representation of signed numbers. It provides ease of representation and computation. Unlike one’s complement, two’s complement has a unique representation for 0. Two’s complement representation also has a sign bit on the extreme left.

Because there’s a unique representation of 00, the range of two’s complement is larger than one’s complement. The 00 comes from the positive side representation, so the range of an nn-bit two’s complement number is: -2n12^{n-1} to 2n112^{n-1}-1. Note that nn is usually a power of 22.

Get hands-on with 1200+ tech skills courses.