Developer Tools

Signed magnitude.

Convert a signed decimal number to sign-and-magnitude binary or decode a bit pattern back to decimal, and see the same number in one's and two's complement. 4 to 64 bits. Runs in your browser.

Advertisement

Input

Result

Enter a value, then press Calculate.

How signed magnitude works

Same number, three formats

ValueSigned magnitudeOne's complementTwo's complement
5000001010000010100000101
-5100001011111101011111011
-1100000011111111011111111
-127111111111000000010000001

Where it is used

Sign-magnitude is the easiest format for people to read, and it is how floating-point numbers store their sign: the IEEE 754 significand is a sign bit plus a magnitude. Most CPUs store integers in two's complement instead because addition and subtraction then need no special sign handling. See also one's complement and the Binary Converter.

Uses BigInt, so 64-bit values are exact. Nothing is sent anywhere.

FAQ

What is signed magnitude representation?

It stores a number as a sign bit (0 positive, 1 negative) followed by the magnitude in ordinary binary. In 8 bits, -5 is 10000101.

How do I convert signed magnitude binary to decimal?

Read the first bit as the sign, convert the remaining bits to a normal binary number, then make it negative if the sign bit is 1. For 10000101 the magnitude is 0000101 = 5, so the value is -5.

What is the range of signed magnitude?

With n bits, -(2^(n-1) - 1) to 2^(n-1) - 1. For 8 bits that is -127 to +127.

Why does signed magnitude have two zeros?

The sign bit is independent of the magnitude, so 00000000 (+0) and 10000000 (-0) are both valid patterns for zero.

How is it different from two's complement?

In two's complement a negative number is the inverted magnitude plus one, so -5 is 11111011 instead of 10000101, and there is only one zero. The table above shows both for the same values.

Sources

Sources retrieved October 2026.

Advertisement
Advertisement