Twos Complement Calculator
Convert any integer to two's complement binary (and back) for 4, 8, 16, 32, or 64-bit widths.
Conversion Mode
Enter a value and click Convert
Two's Complement Binary
Other Representations
Signed Decimal
Hexadecimal
Octal
Step-by-Step Derivation
Copied!
Summary
Convert any integer to two's complement binary (and back) for 4, 8, 16, 32, or 64-bit widths.
How it works
- Choose a bit width: 4, 8, 16, 32, or 64 bits.
- Enter a decimal integer (or a binary string in "Binary to Decimal" mode).
- The tool checks the value fits in the selected bit width's signed range.
- For positive numbers, the result is the standard binary representation padded with leading zeros.
- For negative numbers, the tool inverts all bits of the absolute value and adds 1.
- Hex and octal equivalents are derived from the resulting bit pattern.
Use cases
- Understand how negative numbers are encoded in assembly or C.
- Verify signed integer overflow boundaries when writing embedded firmware.
- Debug bit-manipulation code by checking the expected binary pattern.
- Convert raw memory dumps to signed decimal values.
- Teach or learn computer architecture and binary arithmetic.
- Quickly compute the two's complement of a value for interview practice.
Frequently Asked Questions
Last updated: 2026-06-10 ·
Reviewed by Nham Vu