Two's Complement Converter

Convert signed numbers to binary and back at any bit width.

Your input

A decimal (negative allowed), or 0xFF / 0b1010 bits.
32-bit two's complement 11111111 11111111 11111111 11010110
Signed value
-42
Unsigned value
4294967254
Hex
0xFFFFFFD6
Range at this width
-2147483648 to 2147483647
  • To negate: write 42 in binary (00000000 00000000 00000000 00101010), invert every bit, then add 1.

What is two's complement?

Two's complement is the standard way computers store negative whole numbers. Positive numbers are written normally in binary. A negative number is written by taking the positive version, flipping every bit and adding 1. The leftmost bit then shows the sign: 1 means negative.

At 8 bits, -1 is 11111111 and -128 is 10000000, while the largest positive number is 127 (01111111). The same bits can mean 255 or -1, depending on whether you read them as unsigned or signed. This tool converts a decimal number to its bits and hex at your chosen width, and reads bit patterns back as a signed value.

How to use the Two's Complement Converter

  1. Enter a number, or bits such as 0xFF or 0b1010.
  2. Choose the bit width.
  3. Read the binary, signed, unsigned and hex forms.
  4. Check the range for that width.

Real situations

When people use the Two's Complement Converter

  • 1

    Understand why -1 is all ones

    See that 8-bit -1 is 11111111 and what that means as an unsigned 255.

  • 2

    Read a value from a debugger or register

    Paste 0xFF or a bit string and see the signed meaning at that width.

  • 3

    Find out whether a number fits

    The range shows the smallest and largest values for each width, so you can check for overflow.

  • 4

    Do homework or exam practice

    Check hand conversions against the real result and read the steps for negating.

FAQ

Two's Complement Converter: questions answered

What is -42 in 32-bit two's complement?

11111111 11111111 11111111 11010110, which is 0xFFFFFFD6 in hex and 4294967254 if read as unsigned. This is the default example in the tool.

How do I make a negative number by hand?

Write the positive number in binary at the chosen width, invert every bit, then add 1. For -42, 42 is 00101010, inverted is 11010101, and adding 1 gives 11010110 in 8 bits.

What range can each width hold?

8 bits: -128 to 127. 16 bits: -32768 to 32767. 32 bits: -2147483648 to 2147483647. 64 bits: -9223372036854775808 to 9223372036854775807.

What if I type 200 at 8 bits?

200 does not fit in the signed range, so the bits 11001000 are read as the signed number -56. The unsigned value stays 200. The tool shows both so you can see the wrap-around.

How do I read 0xFF?

At 8 bits it is 11111111, which is -1 signed and 255 unsigned. Enter it with the 0x prefix and the tool reads it as bits.

Why is there one more negative number than positive?

Zero uses one of the patterns with a leading 0, so positive numbers run from 0 to 127 while negatives run from -1 to -128 in 8 bits. The most negative number has no positive partner.

Is this Two's Complement Converter free and private?

Yes. It is free with no sign-in, and every calculation runs inside your browser. Nothing you type is sent to a server or stored, and the page keeps working offline once it has loaded.

Private by design. No accounts, no cookies, no tracking. Everything you type stays on your device.

How we keep it that way