About this tool
The Two's Complement Converter encodes a signed integer into its two's-complement binary and hexadecimal representation at a bit width you choose (4, 8, 16, 32 or 64 bits), and decodes a binary or hex pattern back into the signed value it represents. It uses BigInt throughout, so 64-bit values are handled exactly with no precision loss.
For a width of N bits the signed range is −2^(N−1) to 2^(N−1)−1. To encode a decimal d: if d is non-negative the pattern is simply d; if d is negative the pattern is 2^N + d (equivalently, invert all bits of |d| and add 1). The tool outputs the N-bit zero-padded binary, the N/4-digit hex, the one's complement (bitwise NOT), and the unsigned interpretation of the same bits, and it flags an overflow error when a value does not fit the selected width.
To decode, paste a binary or hex pattern and the tool reads its top bit: if the most significant bit is set the value is pattern − 2^N (negative), otherwise it is the pattern itself. It always shows both the signed and unsigned readings side by side, which is exactly the ambiguity two's complement resolves at the hardware level. All computation is local to your browser.