Two's Complement Calculator
Convert decimal numbers to and from two's complement binary representation. Supports 8, 16, and 32-bit formats with step-by-step explanation.
Was this calculator helpful?
How to use this tool?
This calculator converts a decimal integer to its two's complement binary representation for a chosen bit width.
- Select Bit Width: Choose 8, 16, or 32 bits from the dropdown.
- Enter a Decimal Number: Type an integer into the input field. The number must be within the range for the selected bit width (e.g., -128 to 127 for 8-bit).
- Click "Convert": Press the button to perform the conversion.
- View Results:
- Binary (Two's Complement): Shows the binary representation, grouped in 4-bit nibbles for readability.
- Decimal Value: Confirms the original decimal number you entered.
- Explanation: Provides a step-by-step breakdown of the conversion process, especially for negative numbers.
Note: The calculator only accepts integer inputs. If the number is out of range or not an integer, an error message will appear below the input field.
Previous Results
| Result | Inputs | Date |
|---|
Frequently Asked Questions
Two's complement is a way to represent signed integers in binary. It is the most common method for representing negative numbers in computer systems.
First, write the absolute value in binary. Then invert all bits (change 0 to 1 and 1 to 0). Finally, add 1 to the inverted binary number.
For 8-bit two's complement, the range is -128 to 127.