Signed and Unsigned Binary Converter – Free

This signed and unsigned binary converter shows both decimal readings of the same bits: the unsigned value and the two's complement signed value at the width you typed.

How to use the Binary Signed unsigned Converter tool

  1. Enter the bit pattern in the Binary word box, including every leading zero of the word.
  2. Select Convert to interpret the pattern both ways.
  3. Read the two lines in the Result box. The first is labeled Signed and the second Unsigned.
  4. Select Copy to copy both lines, or Clear to enter another word.

One bit pattern, two integers

Memory holds bits, not signs. Whether 11010111 means 215 or -41 depends on the type the program assigns to it. An unsigned type gives every bit a positive weight. A two's complement signed type gives the top bit a negative weight: in 8 bits it counts as -128 where the unsigned reading counts +128.

That is the whole difference. When the top bit is 0 the two readings agree. When it is 1, the signed value equals the unsigned value minus 2^n, where n is the word width.

Worked example with the 8-bit word 11010111

Unsigned, the set bits add up to 128 + 64 + 16 + 4 + 2 + 1 = 215. Signed, the top bit contributes -128 and the rest contribute 87, giving -41. You can check it with the shortcut: 215 - 256 = -41.

11010111
Signed: -41
Unsigned: 215

01010111
Signed: 87
Unsigned: 87

Why the number of digits matters

The tool uses the count of digits as the word size, so the leftmost digit you type is the sign bit. 111 is a 3-bit word and reads as -1 signed and 7 unsigned. Add one leading zero, 0111, and both readings are 7. A single 1 is a one-bit word whose signed value is -1.

To test a 16-bit or 32-bit register, enter all 16 or 32 bits. Spaces and line breaks between groups are ignored and one 0b prefix is allowed, so 0b1111 1111 1111 1111 is read as a 16-bit word: -1 signed, 65535 unsigned. Words can be up to 65,536 bits long and the decimal values are exact at any length.

Ranges for common word sizes

These are the limits for the widths most code deals with. The signed range always has one more negative value than positive.

  • 8 bits: 0 to 255 unsigned, -128 to 127 signed.
  • 16 bits: 0 to 65,535 unsigned, -32,768 to 32,767 signed.
  • 32 bits: 0 to 4,294,967,295 unsigned, -2,147,483,648 to 2,147,483,647 signed.
  • n bits: 0 to 2^n - 1 unsigned, -2^(n-1) to 2^(n-1) - 1 signed.

Where signed and unsigned readings collide

The mismatch causes real bugs. A Java byte is always signed, so a byte read from a file as 0xD7 prints as -41 until you mask it with 0xFF. A C comparison between int and unsigned int converts the int, so -1 becomes the largest unsigned value. Sensor registers, checksums and network fields are often unsigned while the variable receiving them is not.

Frequently asked questions

How do I convert an unsigned binary value to signed by hand?

Look at the top bit. If it is 0, the signed value is the same. If it is 1, subtract 2^n from the unsigned value, where n is the number of bits. For 11010111, that is 215 - 256 = -41.

Why does the tool show two different numbers for one input?

The bits are the same but the rules for reading them differ. Unsigned treats the top bit as a large positive weight. Two's complement treats it as the same weight with a minus sign.

Why is a single 1 reported as -1?

A one-digit input is a one-bit word, and its only bit is the sign bit with weight -1. Enter 01 or 00000001 to describe a positive one in a wider word.

Does it support 64-bit and larger words?

Yes. Any width from 1 to 65,536 bits works. The values are computed with arbitrary-precision integers, so a 64-bit pattern such as a 1 followed by 63 zeros gives exact results with no rounding.

Can it read one's complement or signed magnitude words?

No. The signed line is always the two's complement reading. For a signed magnitude word, convert it with the Signed magnitude to Binary tool first and then paste the result here.

Related tools