One's Complement Calculator

One's Complement Visualization
Enter a binary number

Understanding One's Complement

What is One's Complement?

One's complement is a method used in computing to represent signed numbers in binary. It's a way to represent negative numbers by inverting all the bits of the positive number.

Formula for One's Complement

The one's complement of a binary number is obtained by inverting all bits in the binary number. This means:

  • 0 becomes 1
  • 1 becomes 0

Mathematically, for an n-bit number B, its one's complement B' is given by:

\[B' = (2^n - 1) - B\]

Calculation Steps

Let's find the one's complement of 1010:

  1. Start with the binary number: 1010
  2. Invert each bit:
    • 1 → 0
    • 0 → 1
    • 1 → 0
    • 0 → 1
  3. Result: 0101

Example and Visual Representation

1 0 1 0 0 1 0 1

This diagram illustrates the one's complement conversion of 1010 to 0101.