Signed vs unsigned: the same bits, read two ways
An unsigned binary number uses every bit for magnitude, so 8 bits count from 0 to 255. A signed number also needs negative values, and almost every computer stores them in two's complement, where the top bit carries a negative weight, so 8 bits cover -128 to 127. The bits themselves are the same: 11111111 is 255 when read as unsigned and -1 when read as signed. Nothing in the bits says which reading is meant; the program and the instructions it uses decide. The adder does not care which you mean; the comparison, the overflow check and the widening do.
What changes between signed and unsigned
Addition and subtraction use exactly the same hardware for both, which is the great advantage of two's complement. What differs is interpretation: comparison (11111111 is the biggest unsigned 8-bit value but a negative signed one), error detection (an unsigned result is wrong when the carry out is 1, a signed one when the overflow flag is set, which the carry vs overflow lesson explains), and widening (unsigned values are padded with 0s, signed values copy their sign bit, called sign extension). Unsigned suits sizes, counts and addresses; signed suits anything that can go below zero.
Try it in digiwleea
Type any value into the two's complement calculator to see its signed and unsigned readings side by side, or open a worked example such as the two's complement of 5. The overflow lesson shows signed and unsigned overflow on real additions, and in the course you build the adder-subtractor that handles both with one circuit.
8-bit examples
| Bits | Unsigned | Signed (two's complement) |
|---|---|---|
| 00000000 | 0 | 0 |
| 01111111 | 127 | 127 |
| 10000000 | 128 | -128 |
| 11111110 | 254 | -2 |
| 11111111 | 255 | -1 |
No sign-up is needed to start: open the lab and place your first transistor, or read the free theory course. The account (and the AI tutor) are optional.
More comparisons: Digital logic concepts compared
See for yourself: build a logic gate from transistors in the simulator, then follow the path from sand to an 8-bit CPU.
Open the digiwleea lab →Frequently asked
What is the difference between signed and unsigned numbers?
Unsigned numbers are always zero or positive and use all bits for magnitude. Signed numbers can be negative; in two's complement the top bit has a negative weight, so the range is split around zero.
What is the range of an 8-bit signed and unsigned number?
Unsigned 8-bit: 0 to 255. Signed 8-bit (two's complement): -128 to 127. In general n bits give 0 to 2^n - 1 unsigned and -2^(n-1) to 2^(n-1) - 1 signed.
Does a computer add signed and unsigned numbers differently?
No. With two's complement the same adder produces the right bits for both. Only the interpretation of the result, and which flag signals an error (carry or overflow), differs.
What is 11111111 in signed and unsigned?
255 as an unsigned 8-bit number and -1 as a signed (two's complement) 8-bit number.