How to write a negative number in binary
- Write the positive number in binary. For -5 in 8-bit, 5 = 00000101
- Invert every bit. 0 becomes 1 and 1 becomes 0: 11111010
- Add 1. 11111010 + 1 = 11111011. That is -5 in 8-bit two's complement.
- Read it back. A leftmost 1 means negative. Subtract 2n from the unsigned value: 11111011 = 251, and 251 − 256 = −5.
Negative numbers in binary: reference table
| Decimal | 8-bit | 16-bit |
|---|---|---|
| -1 | 1111 1111 | 1111 1111 1111 1111 |
| -2 | 1111 1110 | 1111 1111 1111 1110 |
| -3 | 1111 1101 | 1111 1111 1111 1101 |
| -4 | 1111 1100 | 1111 1111 1111 1100 |
| -5 | 1111 1011 | 1111 1111 1111 1011 |
| -6 | 1111 1010 | 1111 1111 1111 1010 |
| -7 | 1111 1001 | 1111 1111 1111 1001 |
| -8 | 1111 1000 | 1111 1111 1111 1000 |
| -9 | 1111 0111 | 1111 1111 1111 0111 |
| -10 | 1111 0110 | 1111 1111 1111 0110 |
| -11 | 1111 0101 | 1111 1111 1111 0101 |
| -12 | 1111 0100 | 1111 1111 1111 0100 |
| -13 | 1111 0011 | 1111 1111 1111 0011 |
| -15 | 1111 0001 | 1111 1111 1111 0001 |
| -16 | 1111 0000 | 1111 1111 1111 0000 |
| -20 | 1110 1100 | 1111 1111 1110 1100 |
| -32 | 1110 0000 | 1111 1111 1110 0000 |
| -50 | 1100 1110 | 1111 1111 1100 1110 |
| -64 | 1100 0000 | 1111 1111 1100 0000 |
| -100 | 1001 1100 | 1111 1111 1001 1100 |
| -127 | 1000 0001 | 1111 1111 1000 0001 |
| -128 | 1000 0000 | 1111 1111 1000 0000 |
Range by bit width
| Bits | Range |
|---|---|
| 8-bit | -128 to 127 |
| 16-bit | -32,768 to 32,767 |
| 32-bit | -2,147,483,648 to 2,147,483,647 |
| 64-bit | -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
Frequently asked questions
What is -1 in binary?
In two's complement, -1 is all ones: 11111111 in 8-bit, 1111111111111111 in 16-bit, and 32 ones in 32-bit. Take 1 (00000001), invert every bit (11111110), then add 1 to get 11111111.
What is -5 in binary?
-5 in 8-bit two's complement is 11111011. Start with 5 = 00000101, invert the bits to 11111010, then add 1 to get 11111011. In 16-bit it is 1111111111111011.
How do you write a negative number in binary?
Computers use two's complement. Write the positive number in binary at your chosen bit width, flip every 0 to 1 and every 1 to 0, then add 1. The leftmost bit is the sign bit: 1 means negative, 0 means positive or zero.
Why does the bit width matter?
Two's complement pads with the sign bit, so the same number looks different at each width: -5 is 11111011 in 8-bit and 1111111111111011 in 16-bit. The width also limits the range. 8-bit holds -128 to 127, 16-bit holds -32,768 to 32,767, and 32-bit holds about ±2.1 billion.
How do I convert two's complement binary back to decimal?
Switch to "Binary → Decimal" and pick the bit width. If the leftmost bit is 1 the number is negative: subtract 2^n from its unsigned value. For example 11111011 is 251 unsigned, and 251 − 256 = −5.
How do I convert letters or words to binary instead?
This page converts numbers. To turn text like "Hello" into 8-bit binary codes, use the Binary Translator. Open the Binary Translator →
Is this the same as signed magnitude or one's complement?
No. Signed magnitude just sets the first bit (−5 = 10000101) and one's complement only inverts (−5 = 11111010). Both have two zeros and are rarely used today. Two's complement, used by virtually every CPU and programming language, adds 1 after inverting.