Negative Number to Binary Converter

Convert negative (and positive) decimal numbers to two's complement binary, or decode signed binary back to decimal. Pick 8, 16, 32 or 64 bits. Enter several numbers separated by spaces or new lines.

Runs locallyInstantPrivate
Input
Output
Two's complement binary appears here.

How to write a negative number in binary

  1. Write the positive number in binary. For -5 in 8-bit, 5 = 00000101
  2. Invert every bit. 0 becomes 1 and 1 becomes 0: 11111010
  3. Add 1. 11111010 + 1 = 11111011. That is -5 in 8-bit two's complement.
  4. 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

Decimal8-bit16-bit
-11111 11111111 1111 1111 1111
-21111 11101111 1111 1111 1110
-31111 11011111 1111 1111 1101
-41111 11001111 1111 1111 1100
-51111 10111111 1111 1111 1011
-61111 10101111 1111 1111 1010
-71111 10011111 1111 1111 1001
-81111 10001111 1111 1111 1000
-91111 01111111 1111 1111 0111
-101111 01101111 1111 1111 0110
-111111 01011111 1111 1111 0101
-121111 01001111 1111 1111 0100
-131111 00111111 1111 1111 0011
-151111 00011111 1111 1111 0001
-161111 00001111 1111 1111 0000
-201110 11001111 1111 1110 1100
-321110 00001111 1111 1110 0000
-501100 11101111 1111 1100 1110
-641100 00001111 1111 1100 0000
-1001001 11001111 1111 1001 1100
-1271000 00011111 1111 1000 0001
-1281000 00001111 1111 1000 0000

Range by bit width

BitsRange
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.

Related tools