Last updated October 10, 2026 · Report an error
Two's complement is how virtually all modern computers represent signed (positive and negative) integers in binary, using the leading bit to indicate sign.
This calculator converts between decimal and two's complement binary for a chosen bit width.
How it works
Choose a direction and bit width (8, 16, or 32-bit), then enter a value. Positive numbers convert like standard binary. Negative numbers are found by adding 2 to the power of the bit width to the (negative) decimal value, then converting that to binary.
- Enter direction.
- Enter bit width.
- Enter value.
- Click Calculate to see your results.
Examples
-5 in 8-bit
The decimal value -5 in 8-bit two's complement is 11111011.
Who should use it
- Coursework in computer architecture or digital logic.
- Debugging low-level code that works directly with signed binary values.
Industry applications
- Computer science and software engineering education
- Embedded systems and low-level programming
Advantages
- Shows the full formula and working, not just the final answer.
- Supports the three most common bit widths used in practice.
Limitations
- Limited to 8, 16, and 32-bit widths.
Common mistakes to avoid
- Entering a value outside the valid range for the selected bit width (e.g., 200 in an 8-bit signed field).
- Reading a two's complement binary value as if it were unsigned, missing that a leading 1 means the value is negative.
Best practices
- Always confirm the bit width matches what your target system actually uses — the same binary pattern means a different decimal value at different bit widths.
Tips
- A quick way to negate a two's complement number by hand: flip every bit, then add 1 — this is exactly equivalent to the "add 2^n" formula used in this calculator.