Try it
Original
Every bit flipped
Understand the result
What's going on
One’s complement is the simplest operation you can do to a binary number: flip every bit. Every 0 becomes a 1 and every 1 becomes a 0. It looks trivial, but it’s the first of two steps computers use to represent negative numbers in binary.
The formula
complement = NOT(value)
Applied bit by bit, at whatever bit width you’re working in.
Show the derivation, mnemonic, and worked example
Build it up
Write out the number in binary at a fixed width, then invert each digit in place - no carrying, no borrowing, just a straight swap. Whatever bits were 1s are now 0s and vice versa. The result is the number’s complement: together, the original and its one’s complement always add up to all 1s.
Worked example
Worked example
18 in 8-bit binary: 00010010
Flip every bit: 11101101
= 237 (unsigned)





