Signed Number Representations

Compare the four ways to store a negative number in binary. Sign-magnitude, ones’ complement, two’s complement and offset binary side by side, from a value or from a bit pattern.

Converter Number Systems Updated Oct 3, 2026
How to Use
  1. Choose value to bits to encode a number, or bits to value to read a pattern.
  2. Pick the width: 4, 8, 16 or 32 bits.
  3. Type a signed whole number, or a pattern in binary or hex (0x…).
  4. Compare the four rows: the drawing colours each scheme, and the readouts give the bits or the values.
  5. Show Work explains each scheme for your number.
Input
signed decimalbinary or 0x…
Presets
Four ways to store it
Sign-magnitude
—
Ones’ complement
—
Two’s complement
—
Offset binary
—

Worked Example

−42 in 8 bits, four ways. 42 in binary is 0010 1010. Sign-magnitude: set the top bit, 1010 1010 (0xAA). Ones’ complement: invert every bit, 1101 0101 (0xD5). Two’s complement: invert and add 1, 1101 0110 (0xD6). Offset binary: add 128, giving 86, 0101 0110 (0x56).

One pattern, four meanings. 1000 0000 is −0 in sign-magnitude (a sign with no size), −127 in ones’ complement (invert it to 0111 1111), −128 in two’s complement, and 0 in offset binary (128 − 128).

The common mistake: mixing up the schemes. 1010 1010 is −42 only in sign-magnitude. Read as two’s complement, which is what a program will do, it is −86. Always know which scheme a value was written in before reading its bits.

Show Work

Enter a number to see the step-by-step working.

Formulas

Sign-magnitude
sign bit + |x|
range ±(2n−1 − 1), two zeros
Ones’ complement
−x = ~x
range ±(2n−1 − 1), two zeros
Two’s complement
−x = ~x + 1
range −2n−1 … 2n−1 − 1
Offset binary
stored = x + 2n−1
same range as two’s complement
Offset ↔ two’s
flip the top bit
0x56 ↔ 0xD6

Where Each Scheme Lives On

In the 1950s and 1960s the choice was open. The IBM 7090 used sign-magnitude, the CDC 6600 and UNIVAC 1100 series ones’ complement, and the PDP-8 and IBM System/360 two’s complement, which won because one adder serves signed and unsigned numbers and there is only one zero.

The others never disappeared. Every IEEE 754 float stores its sign as sign-magnitude and its exponent in offset (biased) form. The Internet checksum in IPv4, TCP and UDP headers adds 16-bit words in ones’ complement arithmetic, because the result does not depend on byte order. And most ADCs and DACs output offset binary, where the codes run in order from the most negative voltage to the most positive.

About This Calculator

This tool shows a signed whole number in sign-magnitude, ones’ complement, two’s complement and offset binary at 4, 8, 16 or 32 bits, or reads one bit pattern under all four. It draws the four patterns together, flags values that one scheme cannot hold, and lists each scheme’s range and zeros.

Everything runs in your browser; nothing is sent anywhere. For the two’s complement steps at 64 bits, and the unsigned reading of a pattern, use the two’s complement converter.

Related calculators: Two’s Complement Converter, IEEE 754 Float Converter, and Number Base Converter.

Frequently Asked Questions

What is the difference between ones' and two's complement?

Ones' complement negates a number by inverting every bit; two's complement inverts and then adds 1. So −42 at 8 bits is 11010101 in ones' complement and 11010110 in two's complement. Ones' complement has two zeros (00000000 and 11111111); two's complement has one, and gains an extra negative value, −128.

What is sign-magnitude?

The way we write numbers on paper: one bit for the sign and the rest for the size. −42 at 8 bits is 1 0101010. It is easy to read but awkward to add with, and has a +0 and a −0. The sign of an IEEE 754 floating-point number works this way.

What is offset binary?

Add a fixed offset so that every value becomes positive: with 8 bits and an offset of 128, −128 is 00000000, 0 is 10000000 and 127 is 11111111. It sorts in numeric order, which is why ADCs and DACs use it. IEEE 754 exponents use the same idea with an offset (bias) of 127 for single precision.

Why does negative zero exist?

In sign-magnitude, 10000000 is a sign bit with a magnitude of zero. In ones' complement, inverting 00000000 gives 11111111. Both mean −0, which equals +0 but has different bits, so hardware had to treat them as equal. Two's complement and offset binary have a single zero.

Which one do computers use?

Two's complement, for virtually all integers since the 1960s, because one adder handles signed and unsigned numbers alike. Ones' complement survives in the Internet checksum, sign-magnitude in floating-point signs, and offset binary in floating-point exponents and data converters.

How do I use the Signed Number Representations?

Just type or paste your value. The answer shows up right away — there is no button to press. Change anything and it updates by itself.

Do I need to install or sign up for anything?

Not at all — it runs in the browser with nothing to install and no account. After it loads once, it even works without an internet connection.

Is my information private?

Yes. Everything happens in your browser. Nothing you type is sent to a server or saved anywhere.

Common Use Cases

Coursework

−42 at 8 bits: 0xAA, 0xD5, 0xD6 and 0x56 in the four schemes, side by side.

Negative zero

The pattern 1000 0000 is −0, −127, −128 and 0 under the four schemes.

Data converters

A 4-bit offset-binary ADC reading of 0000 is −8, and 1000 is 0.

Old machines and checksums

Read a ones’ complement value from a CDC or UNIVAC dump, or an Internet checksum.

Last updated: