Two's Complement Converter
This is a decimal/binary to two's complement converter and a two's complement to decimal converter.
It is a system in which the negative numbers are represented by the two's complement of the absolute value.
Example
-9 converts to 11110111 (to 8 bits), which is -9 in two’s complement.
Complementing it would make it 9, or 00001001 to 8 bits.
The two’s complement is a method for representing positive and negative integer values in the decimal number system.
The two’s complement automatically includes the sign bit.
If input number is a decimal number(with or without sign) then we covert decimal number into binary number
else we first form the one's complement for given binary number and then add 1 to the one’s complement.
Two’s complement for binary number
Step 1: Begin with the binary value
10011001
Step 2: Formed the one's complement as follows:
01100110
Step 3: Add 1 to the one's complement
01100110 (One's complement)
+ 1 (Add 1)
--------------
01100111 (Two's complement)
--------------
Two’s complement for decimal number
lets take the example of decimal (-44) to form 2's complements as follows:
Step 1: Begin with the decimal value -44
The value will be converted into binary as 00101100
Step 2: Formed the one's complement as follows:
11010011
Step 3: Add 1 to the one's complement
11010011 (One's complement)
+ 1
(Add 1)
---------------
11010100 (Two's complement)
---------------
One's and Two's complement for decimal value 0 to 127 and -1 to -128
Decimal |
2's complement |
1's complement |
Decimal(-) |
2's complement |
1's complement |
0 |
0000 0000 |
1111 1111 |
|
|
|
1 |
0000 0001 |
1111 1110 |
-1 |
1111 1111 |
0000 0000 |
2 |
0000 0010 |
1111 1101 |
-2 |
1111 1110 |
0000 0001 |
3 |
0000 0011 |
1111 1100 |
-3 |
1111 1101 |
0000 0010 |
4 |
0000 0100 |
1111 1011 |
-4 |
1111 1100 |
0000 0011 |
5 |
0000 0101 |
1111 1010 |
-5 |
1111 1011 |
0000 0100 |
6 |
0000 0110 |
1111 1001 |
-6 |
1111 1010 |
0000 0101 |
7 |
0000 0111 |
1111 1000 |
-7 |
1111 1001 |
0000 0110 |
8 |
0000 1000 |
1111 0111 |
-8 |
1111 1000 |
0000 0111 |
9 |
0000 1001 |
1111 0110 |
-9 |
1111 0111 |
0000 1000 |
10 |
0000 1010 |
1111 0101 |
-10 |
1111 0110 |
0000 1001 |
11 |
0000 1011 |
1111 0100 |
-11 |
1111 0101 |
0000 1010 |
12 |
0000 1100 |
1111 0011 |
-12 |
1111 0100 |
0000 1011 |
13 |
0000 1101 |
1111 0010 |
-13 |
1111 0011 |
0000 1100 |
14 |
0000 1110 |
1111 0001 |
-14 |
1111 0010 |
0000 1101 |
15 |
0000 1111 |
1111 0000 |
-15 |
1111 0001 |
0000 1110 |
16 |
0001 0000 |
1110 1111 |
-16 |
1111 0000 |
0000 1111 |
17 |
0001 0001 |
1110 1110 |
-17 |
1110 1111 |
0001 0000 |
18 |
0001 0010 |
1110 1101 |
-18 |
1110 1110 |
0001 0001 |
19 |
0001 0011 |
1110 1100 |
-19 |
1110 1101 |
0001 0010 |
20 |
0001 0100 |
1110 1011 |
-20 |
1110 1100 |
0001 0011 |
21 |
0001 0101 |
1110 1010 |
-21 |
1110 1011 |
0001 0100 |
22 |
0001 0110 |
1110 1001 |
-22 |
1110 1010 |
0001 0101 |
23 |
0001 0111 |
1110 1000 |
-23 |
1110 1001 |
0001 0110 |
24 |
0001 1000 |
1110 0111 |
-24 |
1110 1000 |
0001 0111 |
25 |
0001 1001 |
1110 0110 |
-25 |
1110 0111 |
0001 1000 |
26 |
0001 1010 |
1110 0101 |
-26 |
1110 0110 |
0001 1001 |
27 |
0001 1011 |
0001 0100 |
-27 |
1110 0101 |
0001 1010 |
28 |
0001 1100 |
1110 0011 |
-28 |
1110 0100 |
0001 1011 |
29 |
0001 1101 |
1110 0010 |
-29 |
1110 0011 |
0001 1100 |
30 |
0001 1110 |
1110 0001 |
-30 |
1110 0010 |
0001 1101 |
31 |
0001 1111 |
1110 0000 |
-31 |
1110 0001 |
0001 1110 |
32 |
0010 0000 |
1101 1111 |
-32 |
1110 0000 |
0001 1111 |
33 |
0010 0001 |
1101 1110 |
-33 |
1101 1111 |
0010 0000 |
34 |
0010 0010 |
1101 1101 |
-34 |
1101 1110 |
0010 0001 |
35 |
0010 0011 |
1101 1100 |
-35 |
1101 1101 |
0010 0010 |
36 |
0010 0100 |
1101 1011 |
-36 |
1101 1100 |
0010 0011 |
37 |
0010 0101 |
1101 1010 |
-37 |
1101 1011 |
0010 0100 |
38 |
0010 0110 |
1101 1001 |
-38 |
1101 1010 |
0010 0101 |
39 |
0010 0111 |
1101 1000 |
-39 |
1101 1001 |
0010 0110 |
40 |
0010 1000 |
1101 0111 |
-40 |
1101 1000 |
0010 0111 |
41 |
0010 1001 |
1101 0110 |
-41 |
1101 0111 |
0010 1000 |
42 |
0010 1010 |
1101 0101 |
-42 |
1101 0110 |
0010 1001 |
43 |
0010 1011 |
1101 0100 |
-43 |
1101 0101 |
0010 1010 |
44 |
0010 1100 |
1101 0010 |
-44 |
1101 0100 |
0010 1011 |
45 |
0010 1101 |
1101 0010 |
-45 |
1101 0011 |
0010 1100 |
46 |
0010 1110 |
1101 0001 |
-46 |
1101 0010 |
0010 1101 |
47 |
0010 1111 |
1101 0000 |
-47 |
1101 0001 |
0010 1110 |
48 |
0011 0000 |
1100 1111 |
-48 |
1101 0000 |
0010 1111 |
49 |
0011 0001 |
1100 1110 |
-49 |
1100 1111 |
0011 0000 |
50 |
0011 0010 |
1100 1101 |
-50 |
1100 1110 |
0011 0001 |
51 |
0011 0011 |
1100 1100 |
-51 |
1100 1101 |
0011 0010 |
52 |
0011 0100 |
1100 1011 |
-52 |
1100 1100 |
0011 0011 |
53 |
0011 0101 |
1100 1010 |
-53 |
1100 1011 |
0011 0100 |
54 |
0011 0110 |
1100 1001 |
-54 |
1100 1010 |
0011 0101 |
55 |
0011 0111 |
1100 1000 |
-55 |
1100 1001 |
0011 0110 |
56 |
0011 1000 |
1100 0111 |
-56 |
1100 1000 |
0011 0111 |
57 |
0011 1001 |
1100 0110 |
-57 |
1100 0111 |
0011 1000 |
58 |
0011 1010 |
1100 0101 |
-58 |
1100 0110 |
0011 1001 |
59 |
0011 1011 |
1100 0100 |
-59 |
1100 0101 |
0011 1010 |
60 |
0011 1100 |
1100 0011 |
-60 |
1100 0100 |
0011 1011 |
61 |
0011 1101 |
1100 0010 |
-61 |
1100 0011 |
0011 1100 |
62 |
0011 1110 |
1100 0001 |
-62 |
1100 0010 |
0011 1101 |
63 |
0011 1111 |
1100 0000 |
-63 |
1100 0001 |
0011 1110 |
64 |
0100 0000 |
1011 1111 |
-64 |
1100 0000 |
0011 1111 |
65 |
0100 0001 |
1011 1110 |
-65 |
1011 1111 |
0100 0000 |
66 |
0100 0010 |
1011 1101 |
-66 |
1011 1110 |
0100 0001 |
67 |
0100 0011 |
1011 1100 |
-67 |
1011 1101 |
0100 0010 |
68 |
0100 0100 |
1011 1011 |
-68 |
1011 1100 |
0100 0011 |
69 |
0100 0101 |
1011 1010 |
-69 |
1011 1011 |
0100 0100 |
70 |
0100 0110 |
1011 1001 |
-70 |
1011 1010 |
0100 0101 |
71 |
0100 0111 |
1011 1000 |
-71 |
1011 1001 |
0100 0110 |
72 |
0100 1000 |
1011 0111 |
-72 |
1011 1000 |
0100 0111 |
73 |
0100 1001 |
1011 0110 |
-73 |
1011 0111 |
0100 1000 |
74 |
0100 1010 |
1011 0101 |
-74 |
1011 0110 |
0100 1001 |
75 |
0100 1011 |
1011 0100 |
-75 |
1011 0101 |
0100 1010 |
76 |
0100 1100 |
1011 0011 |
-76 |
1011 0100 |
0100 1011 |
77 |
0100 1101 |
1011 0010 |
-77 |
1011 0011 |
0100 1100 |
78 |
0100 1110 |
1011 0001 |
-78 |
1011 0010 |
0100 1101 |
79 |
0100 1111 |
1011 0000 |
-79 |
1011 0001 |
0100 1110 |
80 |
0101 0000 |
1010 1111 |
-80 |
1011 0000 |
0100 1111 |
81 |
0101 0001 |
1010 1110 |
-81 |
1010 1111 |
0101 0000 |
82 |
0101 0010 |
1010 1101 |
-82 |
1010 1110 |
0101 0001 |
83 |
0101 0011 |
1010 1100 |
-83 |
1010 1101 |
0101 0010 |
84 |
0101 0100 |
1010 1011 |
-84 |
1010 1100 |
0101 0011 |
85 |
0101 0101 |
1010 1010 |
-85 |
1010 1011 |
0101 0100 |
86 |
0101 0110 |
1010 1001 |
-86 |
1010 1010 |
0101 0101 |
87 |
0101 0111 |
1010 1000 |
-87 |
1010 1001 |
0101 0110 |
88 |
0101 1000 |
1010 0111 |
-88 |
1010 1000 |
0101 0111 |
89 |
0101 1001 |
1010 0110 |
-89 |
1010 0111 |
0101 1000 |
90 |
0101 1010 |
1010 0101 |
-90 |
1010 0110 |
0101 1001 |
91 |
0101 1011 |
1010 0100 |
-91 |
1010 0101 |
0101 1010 |
92 |
0101 1100 |
1010 0011 |
-92 |
1010 0100 |
0101 1011 |
93 |
0101 1101 |
1010 0010 |
-93 |
1010 0011 |
0101 1100 |
94 |
0101 1110 |
1010 0001 |
-94 |
1010 0010 |
0101 1101 |
95 |
0101 1111 |
1010 0000 |
-95 |
1010 0001 |
0101 1110 |
96 |
0110 0000 |
1001 1111 |
-96 |
1010 0000 |
0101 1111 |
97 |
0110 0001 |
1001 1110 |
-97 |
1001 1111 |
0110 0000 |
98 |
0110 0010 |
1001 1101 |
-98 |
1001 1110 |
0110 0001 |
99 |
0110 0011 |
1001 1100 |
-99 |
1001 1101 |
0110 0010 |
100 |
0110 0100 |
1001 1011 |
-100 |
1001 1100 |
0110 0011 |
101 |
0110 0101 |
1001 1010 |
-101 |
1001 1011 |
0110 0100 |
102 |
0110 0110 |
1001 1001 |
-102 |
1001 1010 |
0110 0101 |
103 |
0110 0111 |
1001 1000 |
-103 |
1001 1001 |
0110 0110 |
104 |
0110 1000 |
1001 0111 |
-104 |
1001 1000 |
0110 0111 |
105 |
0110 1001 |
1001 0110 |
-105 |
1001 0111 |
0110 1000 |
106 |
0110 1010 |
1001 0101 |
-106 |
1001 0110 |
0110 1001 |
107 |
0110 1011 |
1001 0100 |
-107 |
1001 0101 |
0110 1010 |
108 |
0110 1100 |
1001 0011 |
-108 |
1001 0100 |
0110 1011 |
109 |
0110 1101 |
1001 0010 |
-109 |
1001 0011 |
0110 1100 |
110 |
0110 1110 |
1001 0001 |
-110 |
1001 0010 |
0110 1101 |
111 |
0110 1111 |
1001 0000 |
-111 |
1001 0001 |
0110 1110 |
112 |
0111 0000 |
1000 1111 |
-112 |
1001 0000 |
0110 1111 |
113 |
0111 0001 |
1000 1110 |
-113 |
1000 1111 |
0111 0000 |
114 |
0111 0010 |
1000 1101 |
-114 |
1000 1110 |
0111 0001 |
115 |
0111 0011 |
1000 1100 |
-115 |
1000 1101 |
0111 0010 |
116 |
0111 0100 |
1000 1011 |
-116 |
1000 1100 |
0111 0011 |
117 |
0111 0101 |
1000 1010 |
-117 |
1000 1011 |
0111 0100 |
118 |
0111 0110 |
1000 1001 |
-118 |
1000 1010 |
0111 0101 |
119 |
0111 0111 |
1000 1000 |
-119 |
1000 1001 |
0111 0110 |
120 |
0111 1000 |
1000 0111 |
-120 |
1000 1000 |
0111 0111 |
121 |
0111 1001 |
1000 0110 |
-121 |
1000 0111 |
0111 1000 |
122 |
0111 1010 |
1000 0101 |
-122 |
1000 0110 |
0111 1001 |
123 |
0111 1011 |
1000 0100 |
-123 |
1000 0101 |
0111 1010 |
124 |
0111 1100 |
1000 0011 |
-124 |
1000 0100 |
0111 1011 |
125 |
0111 1101 |
1000 0010 |
-125 |
1000 0011 |
0111 1100 |
126 |
0111 1110 |
1000 0001 |
-126 |
1000 0010 |
0111 1101 |
127 |
0111 1111 |
1000 0000 |
-127 |
1000 0001 |
0111 1110 |
|
| |
-128 |
1000 0000 |
0111 1111 |