Binary number representation
8-bit
Decimal to binary
You can enter a decimal number between -128 and 127.
Decimal
Binary to decimal
You can write a binary number with no more than 8 digits. You don't have to input leading zeros.
Binary

Here is the two's complement calculator (or 2's complement calculator), a fantastic tool that helps you find the opposite of any binary number, and turn this two's complement to a decimal value. You have an opportunity to learn what the two's complement representation is, and how to work with negative numbers in binary systems. In the text, you can also find how this two's complement converter works, or how to turn any signed binary to decimal by hand.

How to work with negative numbers in binary? - 2's complement representation

In the binary system, all numbers are a combination of two digits, 0 or 1. Each digit corresponds to a successive power of 2, starting on the right.

For example, 12 in binary is 1100, as 12 = 8 + 4 = 1*2³ + 1*2² + 0*2¹ + 0*2⁰ (using scientific notation). An extended version of the binary system is the hexadecimal system (which uses base 16 instead of base 2). The latter is frequency used in many computer softwares and systems.

Learning about binary leads to many natural questions arising - what about negative numbers in the binary system? Or how do I subtract binary numbers? As we can only use 1 to show that something is present, or 0 to mean that there is a lack of that thing, there are two main approaches:

  1. Two's complement representation, or, in other words, signed notation - the first bit tells about the sign. The convention is that a number with a leading 1 is negative, while a leading 0 denotes a positive value. In an 8-bit representation, we can write any number from -128 to 127. The name comes from the fact that a negative number is a two's complement of a positive one.

  2. Unsigned notation - a representation that supports only positive values. Its advantage over the signed one is that, within the same 8-bit system, we can get any number from 0 up to 255.

As long as we need to add or multiply positive numbers, the unsigned notation is good enough. But, usually, the more practical solution is to work with negative numbers as well. A useful thing about the 2's complement representation is that subtraction is equivalent to an addition of a negative number, which we can handle.

How to use two's complement calculator? Two's complement converter in practice

Whenever you want to convert a decimal number into a binary value in two's complement representation, follow these steps:

  1. Choose the number of bits in your notation. The higher value, the broader range of numbers you can input.

  2. Write any whole decimal within the range that appears under the Decimal to binary section.

  3. ... and that's it - the 2's complement calculator will do the rest of the work! It shows the equivalent binary number, as well as its two's complement.

Do you want to estimate the outcome by hand? This is how two's complement calculator does it:

  1. Choose the number of bits in the binaries representation. Let's assume we want values in the 8-bit system.

  2. Write down your number, let's say 16. 16 in binary is 1 0000.

  3. Add some leading 0's, so that the number has eight digits, 0001 0000.

  4. Switch all the digits to their opposite (0→1 and 1→0). In our case 0001 0000 → 1110 1111.

  5. Add 1 to this value, 1101 1111 + 1 = 1111 0000.

  6. 1110 0000 in the two's complement representation is -16 in decimal notation, and is the 2's complement of 0010 0000.

Look, as long as you are proficient in switching digits and adding unity to a binary value, evaluating negative numbers in binary is not a big deal!

Turning two's complement to decimal

Our 2's complement calculator can also work the other way around - converting any two's complement to its decimal value. Let's try to convert 1011 1011, a signed binary, to decimal. There are two useful methods that help you find the outcome:

  1. Convert this signed binary into a decimal, like normal, but multiply the leading digit by -1 instead of 1. Starting from the right:

    decimal = 1*2⁰ + 1*2¹ + 0*2² + 1*2³ + 1*2⁴ + 1*2⁵ + 0*2⁶ - 1*2⁷

    decimal = 1 + 2 + 8 + 16 + 32 - 128 = -69

  2. We can see that the first digit is 1, so our number is negative. First, find its two's complement, then convert the value to a decimal, and come back to the original value:

    1. Reverse digits, 1011 1011 → 0100 0100.
    2. Add a unity, 0100 0100 + 1 = 0100 0101.
    3. Convert to a decimal (starting from the right), decimal = 1*2⁰ + 0*2¹ + 1*2² + 0*2³ + 0*2⁴ + 0*2⁵ + 1*2⁶ + 0*2⁷.
    4. decimal = 1 + 4 + 64 = 69.
    5. As 69 is the absolute value of our initial (negative) binary, add a minus sign in front of it.
    6. 1011 1011 is -69 in two's complement binary notation.

Signed binary to decimal table

If you want to find any whole number in the two's complement eight-bit representation, you may find this table handy. You can see both the value and its two's complement in the same row.

If you are interested in working with the values of a different number of bits, just use our two's complement calculator to save yourself time and effort!

decimal binary decimal binary
0 0000 0000
1 0000 0001 -1 1111 1111
2 0000 0010 -2 1111 1110
3 0000 0011 -3 1111 1101
4 0000 0100 -4 1111 1100
5 0000 0101 -5 1111 1011
6 0000 0110 -6 1111 1010
7 0000 0111 -7 1111 1001
8 0000 1000 -8 1111 1000
9 0000 1001 -9 1111 0111
10 0000 1010 -10 1111 0110
11 0000 1011 -11 1111 0101
12 0000 1100 -12 1111 0100
13 0000 1101 -13 1111 0011
14 0000 1110 -14 1111 0010
15 0000 1111 -15 1111 0001
16 0001 0000 -16 1111 0000
17 0001 0001 -17 1110 1111
18 0001 0010 -18 1110 1110
19 0001 0011 -19 1110 1101
20 0001 0100 -20 1110 1100
21 0001 0101 -21 1110 1011
22 0001 0110 -22 1110 1010
23 0001 0111 -23 1110 1001
24 0001 1000 -24 1110 1000
25 0001 1001 -25 1110 0111
26 0001 1010 -26 1110 0110
27 0001 1011 -27 1110 0101
28 0001 1100 -28 1110 0100
29 0001 1101 -29 1110 0011
30 0001 1110 -30 1110 0010
31 0001 1111 -31 1110 0001
32 0010 0000 -32 1110 0000
33 0010 0001 -33 1101 1111
34 0010 0010 -34 1101 1110
35 0010 0011 -35 1101 1101
36 0010 0100 -36 1101 1100
37 0010 0101 -37 1101 1011
38 0010 0110 -38 1101 1010
39 0010 0111 -39 1101 1001
40 0010 1000 -40 1101 1000
41 0010 1001 -41 1101 0111
42 0010 1010 -42 1101 0110
43 0010 1011 -43 1101 0101
44 0010 1100 -44 1101 0100
45 0010 1101 -45 1101 0011
46 0010 1110 -46 1101 0010
47 0010 1111 -47 1101 0001
48 0011 0000 -48 1101 0000
49 0011 0001 -49 1100 1111
50 0011 0010 -50 1100 1110
51 0011 0011 -51 1100 1101
52 0011 0100 -52 1100 1100
53 0011 0101 -53 1100 1011
54 0011 0110 -54 1100 1010
55 0011 0111 -55 1100 1001
56 0011 1000 -56 1100 1000
57 0011 1001 -57 1100 0111
58 0011 1010 -58 1100 0110
59 0011 1011 -59 1100 0101
60 0011 1100 -60 1100 0100
61 0011 1101 -61 1100 0011
62 0011 1110 -62 1100 0010
63 0011 1111 -63 1100 0001
64 0100 0000 -64 1100 0000
65 0100 0001 -65 1011 1111
66 0100 0010 -66 1011 1110
67 0100 0011 -67 1011 1101
68 0100 0100 -68 1011 1100
69 0100 0101 -69 1011 1011
70 0100 0110 -70 1011 1010
71 0100 0111 -71 1011 1001
72 0100 1000 -72 1011 1000
73 0100 1001 -73 1011 0111
74 0100 1010 -74 1011 0110
75 0100 1011 -75 1011 0101
76 0100 1100 -76 1011 0100
77 0100 1101 -77 1011 0011
78 0100 1110 -78 1011 0010
79 0100 1111 -79 1011 0001
80 0101 0000 -80 1011 0000
81 0101 0001 -81 1010 1111
82 0101 0010 -82 1010 1110
83 0101 0011 -83 1010 1101
84 0101 0100 -84 1010 1100
85 0101 0101 -85 1010 1011
86 0101 0110 -86 1010 1010
87 0101 0111 -87 1010 1001
88 0101 1000 -88 1010 1000
89 0101 1001 -89 1010 0111
90 0101 1010 -90 1010 0110
91 0101 1011 -91 1010 0101
92 0101 1100 -92 1010 0100
93 0101 1101 -93 1010 0011
94 0101 1110 -94 1010 0010
95 0101 1111 -95 1010 0001
96 0110 0000 -96 1010 0000
97 0110 0001 -97 1001 1111
98 0110 0010 -98 1001 1110
99 0110 0011 -99 1001 1101
100 0110 0100 -100 1001 1100
101 0110 0101 -101 1001 1011
102 0110 0110 -102 1001 1010
103 0110 0111 -103 1001 1001
104 0110 1000 -104 1001 1000
105 0110 1001 -105 1001 0111
106 0110 1010 -106 1001 0110
107 0110 1011 -107 1001 0101
108 0110 1100 -108 1001 0100
109 0110 1101 -109 1001 0011
110 0110 1110 -110 1001 0010
111 0110 1111 -111 1001 0001
112 0111 0000 -112 1001 0000
113 0111 0001 -113 1000 1111
114 0111 0010 -114 1000 1110
115 0111 0011 -115 1000 1101
116 0111 0100 -116 1000 1100
117 0111 0101 -117 1000 1011
118 0111 0110 -118 1000 1010
119 0111 0111 -119 1000 1001
120 0111 1000 -120 1000 1000
121 0111 1001 -121 1000 0111
122 0111 1010 -122 1000 0110
123 0111 1011 -123 1000 0101
124 0111 1100 -124 1000 0100
125 0111 1101 -125 1000 0011
126 0111 1110 -126 1000 0010
127 0111 1111 -127 1000 0001
-128 1000 0000
Wojciech Sas, PhD candidate

Get the widget!

Two's Complement Calculator can be embedded on your website to enrich the content you wrote and make it easier for your visitors to understand your message.

It is free, awesome and will keep people coming back!

Two's Complement Calculator