Twos Complement Converter
Convert between signed decimal numbers and their two's-complement binary form.
How computers store negative numbers
Two's complement is the scheme almost every computer uses to represent signed integers in binary — a clever encoding that lets the same addition circuitry handle positive and negative numbers, and gives exactly one representation of zero. This converts between a signed decimal value and its two's-complement binary form at a chosen bit width, so you can see how a number is actually stored.
Enter a value and bit width, and see its two's-complement binary.
Bit width and overflow
The bit width is crucial, because it sets the range of numbers that fit and where two's complement wraps around. In an eight-bit signed value, the numbers run from minus one hundred and twenty-eight to one hundred and twenty-seven, and going past the top wraps to the bottom — the overflow behind many classic bugs. The top bit acts as the sign. Seeing the binary makes these ideas concrete: why a signed value has an asymmetric range, and why adding one to the maximum flips it negative. It is essential for anyone working with low-level code, embedded systems, or bit manipulation.
Common questions
Why do computers use two's complement?
It lets the same circuitry add positive and negative numbers and gives a single representation of zero, unlike other schemes.
What does the bit width control?
The range of values that fit and where the number wraps around — an 8-bit signed value runs from -128 to 127.
Is anything uploaded?
No. The conversion happens in your browser.