All tools
TOOL IDB-SWE-010
Two's complement

Desktop only

Engineering tools are available only on desktop screens.

Two's complement

Signed integer ↔ unsigned hex / binary with two's complement encoding. For decoding I²C sensor frames, accelerometer fields, signed CAN messages.

Sign bit & number line 16-bit · signed
MSB sign LSB — binary — SIGNED RANGE −32 768 0 32 767 value 0
Engineering notes

How it works

  • Negative N → bit-flip + 1 → unsigned representation.
  • If MSB is 1, treat as negative; subtract 2width.
  • Range: −2(N−1) to 2(N−1)−1.

Common usage

  • I²C accelerometer (16-bit signed): bytes high/low → int16.
  • 24-bit ADCs (HX711, MCP3553) need sign-extension to 32-bit.

Result

Live