# One’s Complement Calculator

URL: https://speedycalculator.com/calculators/math/ones-complement/
Last updated: 2026-10-30

> The one's complement calculator converts a signed decimal integer to one's-complement binary for 4 to 64 bits by inverting the bits, or decodes a one's-complement number back to decimal.

## Inputs

- Number of bits
- Conversion
- Decimal number
- Binary number

## Results

- Result
- Binary of the absolute value / input
- Inverted bits
- Decimal value
- Steps

## Formula

```
Negative x: invert every bit of |x| · range for n bits: −(2ⁿ⁻¹ − 1) to 2ⁿ⁻¹ − 1 (with +0 and −0)
```

## Explanation

One's complement represents negative numbers by flipping all bits. It was used in early computers such as the CDC 6600 and survives in the Internet checksum used by IPv4, TCP and UDP.

### How to use the One's Complement Calculator

- **Number of bits**
- **Conversion**
- **Decimal number**
- **Binary number**

Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.

### How it works

Choose the number of bits and the direction. Note that one's complement has two zeros: 0000… and 1111…

## Worked example

Inputs — Number of bits: 8; Conversion: Decimal → one's complement; Decimal number: -5.

Results — **Result = 1111 1010**; Binary of the absolute value / input = 0000 0101; Inverted bits = 1111 1010; Decimal value = -5; Steps = Write |-5| in binary (00000101) and flip every bit..

## Key terms

- **One's complement**: Bitwise inversion of a binary number.

## FAQ

**What is −5 in 8-bit one's complement?**
1111 1010.

**Why are there two zeros?**
0000 0000 (+0) and 1111 1111 (−0).

**Where is one's complement still used?**
In the Internet checksum.

**How does it differ from two's complement?**
Two's complement adds 1 after inverting, removing the second zero.


## Sources

- [Wolfram MathWorld – Binary](https://mathworld.wolfram.com/Binary.html)
- [Harvard CS50 – Binary and bitwise operators](https://cs50.harvard.edu/x/)
