Math
Instant, private, and free
Two's Complement Calculator.
Encode a signed integer as fixed-width two's-complement binary.
On-device calculationNo signup
01
Set your values
Results update as you type.
02 / ANSWER
Binary: 11010110
Unsigned value: 214
Results update automatically as you type.
Use Cases
Computer Science Education
Helps students and educators understand how signed integers are represented in binary and how two's complement works.
Example: Convert -5 to an 8-bit two's complement binary number.
Programming and Debugging
Assists programmers in verifying binary representations of integers, especially when dealing with bitwise operations or low-level data.
Example: Check the two's complement of -128 in a 16-bit system.
Frequently Asked Questions
- What is two's complement?
- Two's complement is a mathematical operation used to represent signed integers in binary. It is the most common method for representing positive and negative numbers in computer systems, allowing for straightforward arithmetic operations.
- How do I use this calculator?
- Enter a signed integer (positive or negative) and choose a bit width (e.g., 8, 16, 32). The calculator will compute the two's complement representation and display the result in binary and decimal.
- What is the range of values for a given bit width?
- For an n-bit two's complement representation, the range is from -2^(n-1) to 2^(n-1)-1. For example, with 8 bits, the range is -128 to 127. The calculator will indicate if the input is out of range.
Tips & Common Mistakes
Tips
- Ensure the bit width is sufficient to represent the signed integer; otherwise, the result may be incorrect or out of range.
- For positive numbers, the two's complement is the same as the standard binary representation.
- For negative numbers, the two's complement is obtained by inverting all bits and adding 1.
- Use the calculator to verify your manual calculations or to quickly convert between decimal and binary.
Common Mistakes to Avoid
- Forgetting to specify the bit width, which can lead to ambiguous or incorrect results.
- Assuming that the two's complement of a positive number is different from its binary representation.
- Misinterpreting the binary output as unsigned when it represents a signed value.
Last updated: August 13, 2026