Two's Complement Calculator (Signed Binary)

Convert a negative or positive decimal number to its two's complement binary and hex pattern at 4, 8, 16, 32 or 64 bits, or decode…

Results

Enter your details and click Calculate to see your results.
About This Calculator

To make a negative number, write its positive value in binary, flip every bit (one's complement) and add 1. The top bit then works as the sign: 1 means negative.

To decode, enter the bit pattern (binary, or hex with 0x) and choose the width. If the top bit is 1, the value is the pattern minus 2^width.

Example

Example: −42 in 8-bit two's complement is 1101 0110 (0xD6), which is 214 if read as unsigned.

Assumptions

Standard two's complement integers as used by every modern CPU. The width must hold the number.

Frequently Asked Questions

What is −1 in two's complement?

All ones: 11111111 in 8 bits (0xFF).

Why use two's complement?

Adding and subtracting work the same for signed and unsigned numbers, and there is only one zero.

Related Calculators

About the Author

Imran Hossain
Imran Hossain

Professional SEO, Digital Marketer Specialist

I am a Certified Google Ads Expert And Professional SEO, Digital Marketing Specialist

View full profile