PB
Available
swap_horiz
lock Free · Private · In-Browser

Two’s Complement Converter

Convert a signed integer to two’s complement binary and hex at a chosen bit width.

See how computers store negatives

Two’s complement is how nearly every processor represents signed integers, and understanding it explains overflow, sign extension, and bit tricks. Enter a signed decimal and a bit width and this shows the exact binary and hexadecimal a machine would hold.

At 16 bits, −42 is stored as 1111111111010110 in binary and 0xFFD6 in hex. Widen it to 32 bits and the same −42 becomes 0xFFFFFFD6, padded with ones — a picture of sign extension in action.

Exact and private

It uses big-integer math so widths up to 64 bits stay exact, and the conversion runs entirely in your browser.

Frequently Asked Questions

What is two’s complement?

The standard way computers store signed integers: negatives are formed by inverting the bits of the positive value and adding one, so arithmetic works without special cases.

Why does bit width matter?

The same value looks different at 8, 16, 32, or 64 bits because negatives are padded with 1s. −1 is 0xFF at 8 bits but 0xFFFF at 16.

Does it decode too?

Enter a value in range for the width and it shows the binary and hex; the sign is handled automatically within the chosen width.

Take it further
All Free Tools

Browse the full set of free, private, in-browser tools.

Learn More arrow_forward