Two's Complement Converter (8–64 bit)
Enter a decimal, hex, binary or octal value and see its 8/16/32/64-bit two's complement bit pattern, with signed and unsigned readings.
Prefix with 0x for hex, 0b for binary, 0o for octal; otherwise decimal. A leading − is allowed.
1101 0110
Two's complement: top bit is the sign. The same pattern reads as one signed and one unsigned value.
How to use
- Type a value as decimal, or with a 0x / 0b / 0o prefix for hex, binary, or octal.
- Pick the bit width (8, 16, 32, or 64).
- Read the signed and unsigned values, the bit pattern, hex/octal, and one's complement; a note appears if the value didn't fit and wrapped.
About this tool
ShowHide
Two's complement is how almost every computer stores signed integers: the top bit is the sign, and a negative number is formed by inverting the bits of its magnitude and adding one. This converter takes any integer — typed as decimal, hex (0x), binary (0b), or octal (0o), positive or negative — fits it into a chosen width of 8, 16, 32, or 64 bits, and shows the resulting bit pattern with the sign bit highlighted. From that one pattern it reads back both the signed (two's complement) value and the unsigned value, along with hex, octal, and the one's complement. It's the quick way to answer questions like "what does 0xFF mean as a signed byte?" (−1) or "how is −128 stored in 8 bits?" (0x80), and to see how values wrap when they overflow a width. Arbitrary-precision BigInt math keeps 64-bit values exact. Everything runs locally; nothing is uploaded.
Frequently asked questions
How is a negative number represented?
In two's complement, you take the binary of the absolute value, invert every bit (one's complement), then add one. For an 8-bit −5: 5 is 00000101, inverted is 11111010, plus one is 11111011 = 0xFB. The top bit being 1 marks it negative. This tool does that automatically for any width.
Why does 0xFF show as both 255 and −1?
The same bit pattern means different numbers depending on whether you read it as unsigned or signed. As an unsigned byte, 11111111 is 255; as a signed two's complement byte, it's −1. Hardware and languages pick one interpretation per type (e.g. uint8 vs int8); this tool shows both at once.
What happens if my number doesn't fit the width?
It wraps. A value outside the width's range is reduced modulo 2^width — the same thing fixed-width integer arithmetic does on overflow. For example 300 in 8 bits becomes 300 − 256 = 44, and the signed reading follows from that pattern. A note flags when wrapping occurred.
What's one's complement versus two's complement?
One's complement is just the bitwise NOT — every 0 becomes 1 and vice versa. Two's complement is one's complement plus one, and it's what modern CPUs use for signed integers because it has a single zero and makes addition uniform. The tool shows the one's complement as an extra reference.
Related tools
IEEE 754 Float Converter (32 & 64-bit)
See the exact IEEE 754 bit layout of any number in float32 and float64 — sign, exponent, mantissa, hex and rounding — or decode hex back to a number.
Convert
Bitwise Calculator
AND, OR, XOR, NOT and bit shifts on two integers — shown in binary, hex, unsigned and signed decimal, with selectable 8, 16, 32 or 64-bit width.
Developer
CRC Calculator: CRC-8, CRC-16, CRC-64 & Modbus
Compute any CRC of 3 to 64 bits — Modbus, CCITT, XMODEM, CRC-64/XZ and 108 more presets, or your own parameters — and find which CRC gives a value.
Developer
MAC to EUI-64 / Link-local
Convert any MAC address into its modified EUI-64 interface ID and the matching IPv6 link-local address — the same form Windows / Linux compute automatically.
Network
CRC-32 Calculator (CRC-32 & CRC-32C)
Compute the CRC-32 (IEEE 802.3, used by zip/gzip/PNG) or CRC-32C (Castagnoli) checksum of text or hex bytes, in hex and unsigned decimal.
Developer
Decimal ↔ Fraction Converter (with Inch-Fraction Table)
Convert any decimal into its closest fraction (adjustable maximum denominator, including 1/16″ inch fractions) and any fraction back to decimal.
Convert