Hex calculator

Arithmetic and bitwise operations on hexadecimal numbers, with 64-bit signed or unsigned semantics — the same rules a CPU (and the HexCalculator iOS app) follows. Results appear in hex, decimal and binary as you type.

Mode

The result appears here as you type.

What this calculator does

  • Arithmetic: addition, subtraction, multiplication and division (truncated, like integer division in C or Swift).
  • Bitwise: AND, OR, XOR, left shift and right shift. Shifts accept amounts from 0 to 63; in signed mode right shift is arithmetic (the sign bit is preserved), in unsigned mode it's logical.
  • Signed mode works on 64-bit two's complement integers (−2⁶³ to 2⁶³−1). Unsigned mode covers 0 to 2⁶⁴−1.
  • Overflow and division by zero are reported, not silently wrapped — you'll see an error instead of a wrong number.

Why hex arithmetic trips people up

Adding hex numbers by hand means carrying at 16 instead of 10 — 0x8 + 0x9 = 0x11, not 0x17. Multiplication and division get worse. In practice nobody does this on paper: you use a programmer's calculator that keeps the base straight for you and shows the same value in decimal and binary, so you can sanity-check against whatever your debugger or datasheet says.

Related tools and guides