Need to find the 2’s complement of a binary number fast? Use the calculator below. Enter a binary or decimal value, pick a bit length, and get the answer with every step shown.
Binary 2’s Complement Calculator
Convert, negate, and decode signed binary numbers with step-by-step work.
What is 2’s Complement?
2’s complement is the standard way computers store signed integers, meaning numbers that can be positive or negative. It uses the leftmost bit as the sign bit: 0 means positive and 1 means negative.
Unlike older systems, 2’s complement has only one representation of zero. It also lets a processor subtract by adding, which keeps hardware simple and fast.
How to Find the 2’s Complement of a Binary Number
The method has two steps, often remembered as “invert and add one.”
- Write the number using a fixed number of bits.
- Flip every bit. This gives the 1’s complement.
- Add 1 to the result.
Example: Find the 2’s Complement of 00000110 (6)
- Original (8-bit): 00000110
- Invert the bits: 11111001
- Add 1: 11111010
So 11111010 represents -6 in 8-bit 2’s complement.
Example: Convert -25 to 8-Bit Binary
- Write 25 in binary: 00011001
- Invert: 11100110
- Add 1: 11100111
How to Convert 2’s Complement Back to Decimal
Check the sign bit first. If it is 0, read the number normally. If it is 1, invert the bits, add 1, and put a negative sign in front of the result.
For 11100111, inverting gives 00011000. Adding 1 gives 00011001, which is 25. The answer is -25.
How to Use This Calculator
- Choose a calculation type: binary to 2’s complement, decimal to binary, or binary to decimal.
- Select a bit length (4, 8, 16, 32, or 64).
- Type your number.
- Click Calculate to see the result, hex value, signed decimal, and steps.
Range of Values by Bit Length
An n-bit number covers -2^(n-1) through 2^(n-1) – 1.
| Bits | Minimum | Maximum |
|---|---|---|
| 4 | -8 | 7 |
| 8 | -128 | 127 |
| 16 | -32,768 | 32,767 |
| 32 | -2,147,483,648 | 2,147,483,647 |
| 64 | -9,223,372,036,854,775,808 | 9,223,372,036,854,775,807 |
The range is slightly lopsided, with one more negative value than positive. That is a direct result of having only one zero.
Why Computers Use 2’s Complement
One zero. Sign-magnitude systems have both +0 and -0, which wastes a pattern and complicates comparisons. 2’s complement has just 00000000.
Simple subtraction. To compute 7 – 3, the processor adds 7 and the 2’s complement of 3. No separate subtraction circuit is needed.
Consistent math. The same addition rules work for positive and negative numbers.
Where 2’s Complement Is Used
Programmers meet it in integer types like int8, int16, and int32. It appears in CPU design, embedded systems, networking, and debugging memory dumps or hex values. It is also a standard topic in computer science courses.
Also see: Binary Division Calculator
Frequently Asked Questions
What is the 2’s complement of 0?
It is 0. Inverting 00000000 gives 11111111, and adding 1 overflows back to 00000000.
How do I find the 2’s complement of a negative number?
Apply the same invert-and-add-one process. Doing it twice returns the original number.
Is 2’s complement the same as the negative of a number?
Yes. In this system, the 2’s complement of a value is its negative.
What is the difference between 1’s and 2’s complement?
The 1’s complement flips the bits. The 2’s complement flips the bits and adds 1, which removes the duplicate zero.
Can I use this calculator for hexadecimal?
The tool outputs hex values for every result. To enter hex, convert it to binary first.
Final Thoughts
The idea behind 2’s complement is simple: invert the bits, add one, and keep track of your bit length. Use the calculator above for quick answers and to check your own work, and use the steps to build lasting understanding.