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.
Input
Result
Enter a value, then press Calculate.
How signed magnitude works
- Sign bit plus magnitude: the leading bit is the sign (0 = positive, 1 = negative) and the remaining bits are the size of the number, written as ordinary binary.
- Example: 5 =
0000101in 7 magnitude bits. With a 0 sign it is00000101; with a 1 sign, -5 is10000101. - Range: n bits hold -(2n-1-1) to 2n-1-1. In 8 bits that is -127 (
11111111) to 127. There is no -128. - Two zeros:
00000000is +0 and10000000is -0. - Decode: look at the first bit for the sign, read the rest as an unsigned number, then apply the sign.
Same number, three formats
| Value | Signed magnitude | One's complement | Two's complement |
|---|---|---|---|
| 5 | 00000101 | 00000101 | 00000101 |
| -5 | 10000101 | 11111010 | 11111011 |
| -1 | 10000001 | 11111110 | 11111111 |
| -127 | 11111111 | 10000000 | 10000001 |
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.