Home › Lifestyle & Gaming Calculators › Two’s (2’s) Complement Calculator (Binary & Signed Integer)
Binary & Computer Science

Two’s (2’s) Complement Calculator (Binary & Signed Integer)

Convert signed decimal integers to Two’s Complement binary, 1’s complement, and hexadecimal across 8-bit, 16-bit, and 32-bit registers.

💻 Calculator Parameters
Calculated Results
2’s Complement Binary
—
Signed binary representation
1’s Complement Binary
—
Bitwise inverted representation
Hexadecimal Representation
—
Base-16 register value
Valid Bit-Width Range
—
Min to Max signed integer

How to Use the Two’s (2’s) Complement Calculator (Binary & Signed Integer)

Two’s complement is the universal mathematical standard used by modern computer processors (ALUs) to represent signed positive and negative integers in binary. Unlike sign-magnitude or one’s complement systems—which suffer from having two distinct representations for zero (+0 and -0)—two’s complement has a single unique zero and allows hardware adders to perform subtraction using standard binary addition circuitry.

Formula and Calculation Methodology

Two’s Complement(x) =
xif x ≥ 0
2n – |x| = ~|x| + 1if x lt; 0
  • n: Number of bits in the CPU register (e.g., 8, 16, or 32 bits)
  • ~|x|: One’s complement (inverting all 0s to 1s and 1s to 0s)
  • + 1: Adding 1 to the least significant bit (LSB) of the 1’s complement

To find the two’s complement of a negative number by hand, first write the positive magnitude in binary padded to your target bit width (such as 8 bits), invert every bit from 0 to 1 and 1 to 0 (producing the 1’s complement), and finally add 1 to the least significant bit. The most significant bit (leftmost bit) serves as the sign bit: 0 indicates a non-negative integer and 1 indicates a negative integer.

8-Bit Two’s Complement Signed Integer Reference Table

Decimal ValueSign-Magnitude1’s Complement2’s ComplementHex
+127 (Max)0111 11110111 11110111 11110x7F
+10000 00010000 00010000 00010x01
00000 00000000 00000000 00000x00
-11000 00011111 11101111 11110xFF
-421010 10101101 01011101 01100xD6
-128 (Min)N/AN/A1000 00000x80

Frequently Asked Questions

Why is the 8-bit two’s complement range -128 to +127 instead of -127 to +127?

Because 00000000 represents zero, there is no redundant ‘-0’ bit pattern. That extra bit pattern (10000000) represents -128, giving one additional negative value.

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

If the leftmost bit is 1, invert all bits, add 1 to the result, convert that positive binary number to decimal, and place a negative sign in front.

What causes two’s complement arithmetic overflow?

Overflow occurs when adding two positive numbers yields a negative sign bit (1) or adding two negative numbers yields a positive sign bit (0), meaning the result exceeded [-2^(n-1), 2^(n-1)-1].