One's Complement Calculator

Invert every bit of a fixed width binary number.

Technology and NetUpdated 2026-11-201 min read
One's Complement Calculator
Whole number from 0 to 255.
Complement in binary
...
Complement as unsigned...
Original in binary...

What it does

One's complement is an old method for representing signed integers. To negate a value, every bit is flipped. The width must be fixed, because the pattern of leading zeros determines the result.

UC Berkeley CS 61C course notes introduce integer representations and explain how bit strings encode signed and unsigned values.

North Carolina State University notes on integer arithmetic compare negation methods. Flipping all bits is simple because no bit depends on another and there are no carries, but one's complement has two zeros and needs an end around carry in addition.

This tool takes a nonnegative integer, writes it with a chosen bit width, flips every bit and reports the resulting pattern and its unsigned decimal interpretation.

Two's complement, which flips the bits and then adds one, replaced one's complement in most modern hardware.

How to use

  1. Enter an integer from 0 to 255.
  2. Choose 8 or 16 bit width.
  3. Read the complemented bit pattern.
  4. Check the unsigned decimal value of that pattern.
  5. Try 5 in 8 bits to get 11111010.
  6. Compare with two's complement on the same input.

Formula

For an N bit value, the one's complement is obtained by replacing each bit b with 1 minus b.
N
Fixed number of bits, here 8 or 16.
bit
A single binary digit.
NOT
Logical inversion of a bit.
end around carry
Carry handling needed for one's complement addition.

The engine pads the input to the chosen width before flipping. It rejects values outside the range that fits the width.

Worked example

Example: 5 in eight bits

Input 5 with 8 bit width.

  1. Five in eight bit binary is 00000101.
  2. Flipping each bit gives 11111010.
  3. As an unsigned 8 bit value, 11111010 is 250.
  4. The tool reports complement 11111010 and unsigned value 250.
  5. In signed one's complement that pattern would represent minus five.
  6. Two's complement would give 11111011, or 251 unsigned.

Reference table

Eight bit one's complement examples
ValueBinaryOne's complementUnsigned
00000000011111111255
10000000111111110254
50000010111111010250
25511111111000000000

Limits

  • The tool supports 8 and 16 bit widths only.
  • Inputs are limited to 255 even in 16 bit mode.
  • It reports the unsigned interpretation of the complemented pattern.
  • It does not perform one's complement arithmetic.

Common mistakes

  • Forgetting to pad with leading zeros before flipping.
  • Confusing one's complement with two's complement.
  • Expecting a single representation of zero.
  • Entering a negative number, which the tool rejects.
  • Reading the unsigned value as the signed value without noting the difference.

Try it yourself

Quick checks. Answers sit tucked under each question.

What is the 8 bit one's complement of 5?

11111010, which is 250 unsigned.

How does two's complement differ?

It adds one after flipping all bits.

How many zeros does one's complement have?

Two, positive zero and negative zero.

Questions

What is one's complement?

A signed integer representation formed by flipping every bit.

Why does width matter?

Leading zeros are part of the representation and get flipped too.

Why was it replaced?

Two's complement has a single zero and simpler arithmetic.

What is end around carry?

A carry correction needed when adding one's complement numbers.

Does the tool do arithmetic?

No. It only forms the complement.

What widths are supported?

8 and 16 bits.

Sources

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.