Compute the one’s complement – simply invert every bit. Historically used for negative numbers (with its odd +0 and -0), it survives today in internet checksums.
Show calculation steps
Processed privately in your browser — nothing you paste is uploaded, logged or stored.
Negation by pure inversion
One’s complement flips every bit and calls the result the negative: 00101010 (+42) becomes 11010101 (−42). Simpler than two’s complement by exactly the “+1”, it pays for that simplicity with two zeros — all-zeros and all-ones both mean zero — and with end-around carry in its arithmetic.
Obsolete in CPUs since the 1970s, the scheme survives in one economically important niche: the Internet checksum used by IPv4, TCP and UDP sums 16-bit words in one’s-complement arithmetic.
Worked example
Value: −42, width 8 |−42| = 00101010 invert 11010101 ← one’s-complement encoding of −42 Invert again → 00101010: inversion is self-inverse.
End-around carry, demystified
When one’s-complement addition overflows the top bit, the carry wraps around and adds to the bottom bit. It compensates for the doubled zero: crossing from negative to non-negative territory skips one code point, and the wrapped carry re-aligns the count. Checksum implementations (RFC 1071) are loops around exactly this rule.
Comparing the complements
At 8 bits: one’s complement spans −127…+127 symmetrically; two’s complement −128…+127 with unique zero. The pattern 11111111 reads −0 here but −1 there — the single most diagnostic pattern when identifying an unknown convention in old data.
Privacy
Inversions run entirely in your browser.
Where one’s complement still runs the world
One’s complement arithmetic looks like a museum piece, yet it sits inside almost every packet on the Internet: the checksums in IPv4, TCP and UDP headers are one’s complement sums, as specified in RFC 1071. The scheme survives there because a one’s complement sum is endian-independent and easy to update incrementally when a single header field changes. Its arithmetic quirk is the end-around carry — a carry out of the top bit is added back into the bottom — and its representational quirk is the double zero: all-zeros and all-ones both decode to zero.
How to use the One's Complement Calculator
- Enter a signed decimal or a raw bit pattern (choose which).
- Set the bit width.
- Click "Compute complement" – inversion is the entire operation, and the steps show it.
- Compare against the two's complement page to see the one-bit difference in action.
Frequently asked questions
What is the one's complement of a number?
The pattern with every bit flipped. As a signing scheme it means negation-by-inversion: 00101010 (+42) inverts to 11010101, which one's complement reads as −42.
Why does one's complement have two zeros?
All-zeros is +0 and all-ones is −0: inverting zero gives the second form. This redundancy wastes a code point and complicates comparisons – one of the reasons two's complement displaced it in CPUs.
Is one's complement completely obsolete then?
Not quite – the Internet checksum family (IPv4 headers, TCP, UDP) still sums in one's-complement arithmetic with end-around carry. Understanding the scheme is required reading for anyone parsing packet checksums.
How does its range compare at 8 bits?
−127 to +127 – symmetric, unlike two's complement's −128..+127. The symmetry is the flip side of the doubled zero: same 256 patterns, allocated differently.
What is end-around carry?
In one's-complement addition, a carry out of the top bit is added back into the bottom bit. It compensates for the double zero and is exactly what checksum algorithms implement.
Does inverting twice restore my pattern?
Always – inversion is self-inverse. That makes the calculator a safe explorer: apply it twice and you must land where you started, a quick integrity check.
Is my input kept anywhere?
No – the inversion happens in the page and nothing is transmitted or stored.