How to Use the Calculator?
To use the calculator, simply enter your number, choose whether it is decimal, hex, or binary, and then select the bit length you want to use. The calculator will automatically display the two’s complement value. The equivalent values in decimal, hex, and octal will also be shown.
What Is Two’s Complement?
In ordinary decimal numbers, we already know how to show negatives: we simply place a minus sign in front, like $-5$ or $-12$. But computers do not store numbers with a little minus sign the way we do in notebooks. Inside a computer, everything must be represented using only $0$s and $1$s.
So the computer needs a smart system for representing both positive and negative integers using the same kind of binary digits. That system is called two’s complement.
How to Find the Two’s Complement
To find the two’s complement, follow this procedure:
- Write the given number in binary using the correct bit width.
- Invert every bit by changing zeroes to ones and ones to zero.
- Add $1$ to the result.
Suppose we want to find two’s complement of $5$ in 8-bit. First write $5$ in binary:
$$ 5 = 00000101 $$
Now invert all bits:
$$ 00000101 \rightarrow 11111010 $$
Then add $1$:
$$ 11111010 + 1 = 11111011 $$
So $5$’s two’s complement in 8-bit is:
$$ 11111011 = -5$$
Understanding Bit Length
While learning about two’s complement numbers, it is extremely important to understand that the number of bits matters. A 4-bit number and an 8-bit number are not interpreted in the same way, even if some of the digits look similar.
For example, $1111$ in 4-bit two’s complement form means $-1$. But $00001111$ in 8-bit two’s complement form means $15$. Even though both numbers end with the same four digits, they do not represent the same value. This shows why bit length must always be considered when reading signed binary numbers.
This is because, in an ordinary 4-bit unsigned binary number, each bit represents a positive power of two. For example, the decimal number $12$ is written as $1100$ in binary, because:
$$ 1 \cdot 2^3 + 1 \cdot 2^2 + 0 \cdot 2^1 + 0 \cdot 2^0 = 12 $$
In a 4-bit two’s complement number, however, the place values are slightly different. The rightmost three positions still represent $2^0$, $2^1$, and $2^2$, but the leftmost bit represents $-2^3$ instead of $+2^3$. This means that a 4-bit two’s complement number can be interpreted by adding signed place values instead of only positive ones.
So the 4-bit signed binary number $1100$ can be read as:
$$ 1 \cdot (-2^3) + 1 \cdot 2^2 + 0 \cdot 2^1 + 0 \cdot 2^0 = -4 $$
This is why $1100$ does not mean $12$ in 4-bit two’s complement. In this system, it represents $-4$. That is one of the most important ideas in signed binary: the same pattern of bits can represent different values depending on whether the number is unsigned or written in two’s complement form.
The Range of Values in Two’s Complement
Because the leftmost bit is used in a special way, a fixed number of bits can represent only a certain range of signed integers. In an $n$-bit two’s complement system, the smallest number is $-2^{n-1}$ and the largest number is $2^{n-1} – 1$.
$$ \text{Range for } n\text{-bit two’s complement} = -2^{n-1} \text{ to } 2^{n-1}-1 $$
For a 4-bit system, that becomes:
$$ -2^{4-1} \text{ to } 2^{4-1}-1 = -8 \text{ to } 7 $$
So the 4-bit two’s complement numbers represent values from $-8$ to $7$. That gives 16 total values, which matches the 16 possible 4-bit patterns.
For an 8-bit system, the range is from $-128$ to $127$. For a 16-bit system, it is from $-32768$ to $32767$.
This range is not perfectly balanced around zero, because there is one more negative number than positive number. That happens because zero takes up one of the non-negative spots. This detail is normal in two’s complement, and it is one reason why the most negative number behaves a little specially.
Building a 4-Bit Two’s Complement Table
A very useful way to understand the system is to look at all 4-bit combinations and their meanings. In 4-bit two’s complement, the values are arranged like this:
$$\begin{aligned} 0000 &= 0 \\ 0001 &= 1 \\ 0010 &= 2 \\ 0011 &= 3 \\ 0100 &= 4 \\ 0101 &= 5 \\ 0110 &= 6 \\ 0111 &= 7 \end{aligned}$$
Then the pattern continues, but now it wraps into negative numbers:
$$\begin{aligned} 1000 &= -8 \\ 1001 &= -7 \\ 1010 &= -6 \\ 1011 &= -5 \\ 1100 &= -4 \\ 1101 &= -3 \\ 1110 &= -2 \\ 1111 &= -1 \end{aligned}$$
It is worth spending time looking at this pattern. Notice that the positive numbers begin with $0$ and the negative numbers begin with $1$. Also notice that $1111$ means $-1$, not $15$, because we are interpreting the bits as signed 4-bit two’s complement, not unsigned binary. This is why context matters.
If you count upward from $0111$, which is $7$, the next pattern is $1000$, which is not $8$ but $-8$. This is the wraparound effect.

So think of two’s complement as a circular number system. If a binary number gets too large, it wraps around. In an unsigned 4-bit system, the numbers go from $0000 = 0$ up to $1111 = 15$. But in a 4-bit two’s complement system, the same 16 bit patterns are shared between positive and negative values. The system wraps so that some patterns represent negative numbers. This wrapping is one of the key ideas that helps make arithmetic work smoothly.
8-Bit Two’s Complement Table
Here is the full list of 8-bit decimal numbers and their corresponding two’s complement for your quick reference.
| Decimal | Two’s Complement | Decimal | Two’s Complement | |
|---|---|---|---|---|
| 1 | 1111 1111 | -1 | 0000 0001 | |
| 2 | 1111 1110 | -2 | 0000 0010 | |
| 3 | 1111 1101 | -3 | 0000 0011 | |
| 4 | 1111 1100 | -4 | 0000 0100 | |
| 5 | 1111 1011 | -5 | 0000 0101 | |
| 6 | 1111 1010 | -6 | 0000 0110 | |
| 7 | 1111 1001 | -7 | 0000 0111 | |
| 8 | 1111 1000 | -8 | 0000 1000 | |
| 9 | 1111 0111 | -9 | 0000 1001 | |
| 10 | 1111 0110 | -10 | 0000 1010 | |
| 11 | 1111 0101 | -11 | 0000 1011 | |
| 12 | 1111 0100 | -12 | 0000 1100 | |
| 13 | 1111 0011 | -13 | 0000 1101 | |
| 14 | 1111 0010 | -14 | 0000 1110 | |
| 15 | 1111 0001 | -15 | 0000 1111 | |
| 16 | 1111 0000 | -16 | 0001 0000 | |
| 17 | 1110 1111 | -17 | 0001 0001 | |
| 18 | 1110 1110 | -18 | 0001 0010 | |
| 19 | 1110 1101 | -19 | 0001 0011 | |
| 20 | 1110 1100 | -20 | 0001 0100 | |
| 21 | 1110 1011 | -21 | 0001 0101 | |
| 22 | 1110 1010 | -22 | 0001 0110 | |
| 23 | 1110 1001 | -23 | 0001 0111 | |
| 24 | 1110 1000 | -24 | 0001 1000 | |
| 25 | 1110 0111 | -25 | 0001 1001 | |
| 26 | 1110 0110 | -26 | 0001 1010 | |
| 27 | 1110 0101 | -27 | 0001 1011 | |
| 28 | 1110 0100 | -28 | 0001 1100 | |
| 29 | 1110 0011 | -29 | 0001 1101 | |
| 30 | 1110 0010 | -30 | 0001 1110 | |
| 31 | 1110 0001 | -31 | 0001 1111 | |
| 32 | 1110 0000 | -32 | 0010 0000 | |
| 33 | 1101 1111 | -33 | 0010 0001 | |
| 34 | 1101 1110 | -34 | 0010 0010 | |
| 35 | 1101 1101 | -35 | 0010 0011 | |
| 36 | 1101 1100 | -36 | 0010 0100 | |
| 37 | 1101 1011 | -37 | 0010 0101 | |
| 38 | 1101 1010 | -38 | 0010 0110 | |
| 39 | 1101 1001 | -39 | 0010 0111 | |
| 40 | 1101 1000 | -40 | 0010 1000 | |
| 41 | 1101 0111 | -41 | 0010 1001 | |
| 42 | 1101 0110 | -42 | 0010 1010 | |
| 43 | 1101 0101 | -43 | 0010 1011 | |
| 44 | 1101 0100 | -44 | 0010 1100 | |
| 45 | 1101 0011 | -45 | 0010 1101 | |
| 46 | 1101 0010 | -46 | 0010 1110 | |
| 47 | 1101 0001 | -47 | 0010 1111 | |
| 48 | 1101 0000 | -48 | 0011 0000 | |
| 49 | 1100 1111 | -49 | 0011 0001 | |
| 50 | 1100 1110 | -50 | 0011 0010 | |
| 51 | 1100 1101 | -51 | 0011 0011 | |
| 52 | 1100 1100 | -52 | 0011 0100 | |
| 53 | 1100 1011 | -53 | 0011 0101 | |
| 54 | 1100 1010 | -54 | 0011 0110 | |
| 55 | 1100 1001 | -55 | 0011 0111 | |
| 56 | 1100 1000 | -56 | 0011 1000 | |
| 57 | 1100 0111 | -57 | 0011 1001 | |
| 58 | 1100 0110 | -58 | 0011 1010 | |
| 59 | 1100 0101 | -59 | 0011 1011 | |
| 60 | 1100 0100 | -60 | 0011 1100 | |
| 61 | 1100 0011 | -61 | 0011 1101 | |
| 62 | 1100 0010 | -62 | 0011 1110 | |
| 63 | 1100 0001 | -63 | 0011 1111 | |
| 64 | 1100 0000 | -64 | 0100 0000 | |
| 65 | 1011 1111 | -65 | 0100 0001 | |
| 66 | 1011 1110 | -66 | 0100 0010 | |
| 67 | 1011 1101 | -67 | 0100 0011 | |
| 68 | 1011 1100 | -68 | 0100 0100 | |
| 69 | 1011 1011 | -69 | 0100 0101 | |
| 70 | 1011 1010 | -70 | 0100 0110 | |
| 71 | 1011 1001 | -71 | 0100 0111 | |
| 72 | 1011 1000 | -72 | 0100 1000 | |
| 73 | 1011 0111 | -73 | 0100 1001 | |
| 74 | 1011 0110 | -74 | 0100 1010 | |
| 75 | 1011 0101 | -75 | 0100 1011 | |
| 76 | 1011 0100 | -76 | 0100 1100 | |
| 77 | 1011 0011 | -77 | 0100 1101 | |
| 78 | 1011 0010 | -78 | 0100 1110 | |
| 79 | 1011 0001 | -79 | 0100 1111 | |
| 80 | 1011 0000 | -80 | 0101 0000 | |
| 81 | 1010 1111 | -81 | 0101 0001 | |
| 82 | 1010 1110 | -82 | 0101 0010 | |
| 83 | 1010 1101 | -83 | 0101 0011 | |
| 84 | 1010 1100 | -84 | 0101 0100 | |
| 85 | 1010 1011 | -85 | 0101 0101 | |
| 86 | 1010 1010 | -86 | 0101 0110 | |
| 87 | 1010 1001 | -87 | 0101 0111 | |
| 88 | 1010 1000 | -88 | 0101 1000 | |
| 89 | 1010 0111 | -89 | 0101 1001 | |
| 90 | 1010 0110 | -90 | 0101 1010 | |
| 91 | 1010 0101 | -91 | 0101 1011 | |
| 92 | 1010 0100 | -92 | 0101 1100 | |
| 93 | 1010 0011 | -93 | 0101 1101 | |
| 94 | 1010 00100 | -94 | 0101 1110 | |
| 95 | 1010 0001 | -95 | 0101 1111 | |
| 96 | 1010 0000 | -96 | 0110 0000 | |
| 97 | 1001 1111 | -97 | 0110 0001 | |
| 98 | 1001 1110 | -98 | 0110 0010 | |
| 99 | 1001 1101 | -99 | 0110 0011 | |
| 100 | 1001 1100 | -100 | 0110 0100 | |
| 101 | 1001 1011 | -101 | 0110 0101 | |
| 102 | 1001 1010 | -102 | 0110 0110 | |
| 103 | 1001 1001 | -103 | 0110 0111 | |
| 104 | 1001 1000 | -104 | 0110 1000 | |
| 105 | 1001 0111 | -105 | 0110 1001 | |
| 106 | 1001 0110 | -106 | 0110 1010 | |
| 107 | 1001 0101 | -107 | 0110 1011 | |
| 108 | 1001 0100 | -108 | 0110 1100 | |
| 109 | 1001 0011 | -109 | 0110 1101 | |
| 110 | 1001 0010 | -110 | 0110 1110 | |
| 111 | 1001 0001 | -111 | 0110 1111 | |
| 112 | 1001 0000 | -112 | 0111 0000 | |
| 113 | 1000 1111 | -113 | 0111 0001 | |
| 114 | 1000 1110 | -114 | 0111 0010 | |
| 115 | 1000 1101 | -115 | 0111 0011 | |
| 116 | 1000 1100 | -116 | 0111 0100 | |
| 117 | 1000 1011 | -117 | 0111 0101 | |
| 118 | 1000 1010 | -118 | 0111 0110 | |
| 119 | 1000 1001 | -119 | 0111 0111 | |
| 120 | 1000 1000 | -120 | 0111 1000 | |
| 121 | 1000 0111 | -121 | 0111 1001 | |
| 122 | 1000 0110 | -122 | 0111 1010 | |
| 123 | 1000 0101 | -123 | 0111 1011 | |
| 124 | 1000 0100 | -124 | 0111 1100 | |
| 125 | 1000 0011 | -125 | 0111 1101 | |
| 126 | 1000 0010 | -126 | 0111 1110 | |
| 127 | 1000 0001 | -127 | 0111 1111 | |
| -128 | 1000 0000 |
