Two's Complement Calculator

Calculation selection:
Decimal:
Binary Numbers:
Two's complement:

Two's complement 1. In computer systems, all values ​​are represented (stored) in two's complement. The main reason: using two's complement, the sign bit and other bits can be processed uniformly; at the same time, subtraction can also be processed as addition. In addition, when two numbers represented in two's complement are added, if the highest bit (sign bit) has a carry, the carry is discarded. 2. The conversion process of two's complement and original code is almost the same.

For example

1111 1111                          255
− 0101 1111                         −  95
===========                         =====
  1010 0000  (反码ones' complement)   160
+         1                          +   1
===========                          =====
  1010 0001  (补码two's complement)     161