Two's Complement Calculator

Your details

Choose whether you are entering a decimal integer, a raw binary string, or a hex value.
The number of bits used to represent the value. 8-bit is the most common for introductory work.
A signed integer. The valid range depends on the bit width selected.
Two's complement (binary)Negative number
11010110

The two's complement binary representation at the selected bit width.

One's complement (binary)00101001
Signed decimal-42
HexadecimalD6
Unsigned decimal214
Range minimum-128
Range maximum127
Signed value-42
Unsigned value214

-42 in 8-bit two's complement is 11010110.

  • The most significant bit is 1, so this represents a negative number (-42) in two's complement notation.
  • If the same bit pattern were read as unsigned, it would equal 214.
  • At 8-bit width the signed range is -128 to 127, giving 256 distinct values.

Next stepTo verify by hand: flip all bits to get the one's complement, then add 1. The result is the magnitude of the negative number.

= Powered by OnlyCalculators