Skip to content
Hex Calculator

Hex One's Complement Calculator

Invert every bit of a hex value at a chosen bit width — one's complement, the older and simpler sign-flip encoding that two's complement replaced in modern hardware.

One's complement result
0xFA
Bit width

Full breakdown (result at 8-bit)

Hexadecimal
0xFA
Decimal (unsigned)
250
Binary
11111010
Octal
372
Set / clear bits
6 set, 2 clear

How to Calculate One's Complement

One's complement is the simpler of the two complement encodings: invert every bit of the value at a fixed bit width — every 0 becomes 1, every 1 becomes 0 — and that's the whole process, no addition involved.

It predates two's complement as a way to represent negative numbers, but fell out of use for that purpose because it has two bit patterns that both mean zero (all bits 0, and all bits 1), which complicates hardware comparisons and arithmetic.

One's Complement Example, Step by Step

05 (8-bit) -> FA

One's complement of 0x05 at 8-bit = 0xFA

05 = 0000 0101

Invert every bit:
1111 1010 = FA
StepDescriptionResult
Invert all bits0000 0101 inverted is 1111 1010FA

Compare this to two's complement of the same value (FB, one more) — the difference between the two encodings is exactly that final +1 step.

Common Mistakes With One's Complement

  • Adding 1 after inverting, which turns it into two's complement instead.
  • Forgetting that one's complement has two zero representations, which can cause confusing comparison results.
  • Applying it at the wrong bit width, changing which bits actually get inverted.
  • Assuming it's still the standard for signed integers in modern software — it isn't; two's complement is.

Frequently Asked Questions

What is one's complement?

Simply inverting every bit of a value at a fixed bit width — every 0 becomes 1 and every 1 becomes 0. It's the first half of two's complement, without the final add-1 step.

Why isn't one's complement used in modern computers?

It has two representations of zero (all-0s and all-1s), which complicates arithmetic circuits and comparisons. Two's complement fixes this by adding 1 after inverting, leaving a single, unambiguous zero.

Where is one's complement still used today?

In some checksum algorithms — the Internet checksum used in IPv4, TCP, and UDP headers is computed using one's-complement addition, which is a different reason to encounter it than representing negative integers.

How is one's complement different from two's complement here?

One's complement just inverts the bits. Two's complement inverts the bits and then adds 1 — that extra step is what makes two's complement the encoding modern processors actually use for signed integers.

Does inverting a value twice give back the original?

Yes — one's complement is its own inverse. Inverting a bit pattern and then inverting the result again always returns the original value.

How do I interpret a one's-complement result as a negative number?

Check the leftmost bit at your bit width — if it's set, the value is negative, and its magnitude is found by inverting the bits again (back to the original) rather than the invert-then-add-1 process two's complement uses.