Want a Custom tool for Yourself?

Need a Custom Tool? We build custom tools that can save hours per employee per day.

Two's Complement Calculator

Find two’s complement for a number in seconds. Choose bit width, enter your value, and copy the two’s complement result instantly. Copy in one click.

Two's Complement Calculator




Result will appear here...


Last updated: February 4, 2026

Created by: Eon Tools Dev Team

Reviewed by: Ankit Khatiwada



What the two's complement calculator does

This shows how a whole number, positive or negative, is stored in binary using two's complement, the scheme nearly all computers use for signed numbers. Pick a bit width, enter a decimal number, and it gives you the bit pattern.

Two's complement answers a question that plain binary cannot: where does the minus sign go? A computer has only 0s and 1s, no symbol for negative, and this is the clever arrangement that lets the bits carry the sign themselves.

How to use it

  1. Choose a bit width. Pick 4, 8, 12, or 16 bits. The tool shows the range of numbers that width can hold.
  2. Enter a decimal number. Type any whole number inside the range shown, positive or negative.
  3. Press Calculate. You will see the number's binary pattern and its two's complement.

Press Reset to clear the input.

The problem with storing negatives

With only two symbols to work with, there is no minus sign to put in front of a number. The fix is to hand over the leftmost bit, the most significant one, to act as a sign: a 0 there means the number is positive, and a 1 means it is negative. Positive numbers then look exactly like ordinary binary. The interesting question is how to fill in the bits for a negative number, and that is where two's complement comes in.

Invert and add one

To find how a negative number is stored, you take the positive version, invert every bit, and add 1. That is the whole recipe. Say you want minus 5 in eight bits. Start with positive 5, which is 00000101. Invert every bit to get 11111010. Then add 1, which gives 11111011. That pattern, 11111011, is how minus 5 is stored, and its leading 1 correctly marks it as negative.

The neat part is that the same recipe runs in reverse. Apply invert and add one to 11111011 and you arrive back at 00000101, which is positive 5. So the one operation both creates a negative number and turns it back into its positive, which is exactly why the scheme is called taking the two's complement.

The range you get

Because the top bit is spent on the sign, a given width holds a smaller span of values than it would unsigned, split across positive and negative. For n bits the range runs from minus 2 to the power of n minus 1, up to 2 to the power of n minus 1, minus 1. In eight bits that is minus 128 to 127, which is exactly why a signed byte tops out at 127. You will notice there is one more negative number than positive. That is because zero takes up one of the positive-looking patterns, all 0s, leaving no room for a matching negative zero, so the extra slot goes to one more negative value instead.

Why computers settled on this

Two's complement won out because it makes the hardware simple. The great advantage is that ordinary binary addition just works, whatever the signs. Add the bit pattern for a positive number to the bit pattern for a negative one, throw away any carry off the top, and the result is correct, with no special handling for the minus. That means a computer needs only one adder for both signed and unsigned numbers, and it can subtract simply by adding the negative. On top of that there is a single, tidy representation of zero, all 0s, with none of the confusion of a separate negative zero. Simpler circuits and one clean zero are why this scheme is everywhere.

Questions people ask

How do I find the two's complement of a number?

Take the positive binary form, invert every bit, and add 1. The result is how the negative of that number is stored, and applying the same steps again returns the original.

What range does a given width hold?

For n bits, from minus 2 to the power of n minus 1, up to 2 to the power of n minus 1, minus 1. Eight bits hold minus 128 to 127, which is the range of a signed byte.

Why invert and add one rather than just flip the bits?

Flipping alone is one's complement, which leaves two different patterns for zero. Adding one removes that second zero and makes ordinary addition come out right for negative numbers.

Why is there one more negative number than positive?

Because zero uses one of the patterns that would otherwise be positive, all 0s. There is no separate negative zero, so that spare pattern becomes one extra negative value instead.

References

  1. Two's complement. Wikipedia, The Free Encyclopedia. https://en.wikipedia.org/wiki/Two's_complement


Ankit Khatiwada

Ankit Khatiwada is a researcher and graduate student in Computer Science at Saarland University, with strengths in statistics, data analysis, data engineering, and full stack development. His work sits at the intersection of quantitative reasoning and applied technology, making him a strong fit for tools that depend on clear numerical logic. At Eon Tools, he reviews number and statistical tools.