Skip to main content
← Back to Tools

Two's Complement Calculator

Convert between signed and unsigned integers of a fixed bit width

Signed range: −128 … 127
Unsigned range: 0 … 255

Binary
0000 0000
Hexadecimal
0x00

How it works

In n-bit two's complement the most significant bit has the weight −2ⁿ⁻¹, so the signed range is −2ⁿ⁻¹ … 2ⁿ⁻¹ − 1 and the unsigned range of the same bit pattern is 0 … 2ⁿ − 1. A negative value −x is stored as the unsigned number 2ⁿ − x.

Example (8 bits): −1 = 0xFF = 255 unsigned, −128 = 0x80 = 128 unsigned.