Hex Calculator

Enter two hexadecimal numbers (0–9 and A–F) and an operation. The answer is exact and also shown in decimal and binary.

Also called: Hexadecimal calculator · Base-16 calculator

  • Last updated
  • Formula tested against reference values

Your numbers

Result

Result (hex)
—

Calculating…

Result in decimal
—
Result in binary
—
Remainder (division only)
—
First number in decimal
—
Second number in decimal
—

How to use this calculator

  1. Enter or choose first hex number.
  2. Enter or choose operation.
  3. Enter or choose second hex number.
  4. The result (hex) updates as you type. Use Copy result or Share to keep it.

Method

Value = Σ dᵢ × 16ⁱ, with digits 0–9 and A = 10, B = 11, C = 12, D = 13, E = 14, F = 15; the operation is done on the exact integers

dᵢ
the hex digit in position i, counted from 0 at the right

Worked example

  1. FF = 15 × 16 + 15 = 255.
  2. 255 + 1 = 256 = 1 × 16², which is 100 in hex.
  3. In binary, 256 = 2⁸ = 100000000.

FF + 1 = 100 in hexadecimal, or 255 + 1 = 256 in decimal.

What the result means

Each hex digit stands for exactly four bits, which is why hex is used for memory addresses, colour codes (#FF8800) and byte values.

Assumptions and limits

  • Inputs are unsigned hexadecimal integers; upper or lower case and a 0x prefix are accepted.
  • Negative results are shown with a minus sign, not in two’s complement.
  • Division gives a whole-number quotient and a remainder.

Questions

How do I convert hex to decimal?

Multiply each digit by a power of 16 from the right (1, 16, 256, 4096, …) and add. 1A = 1 × 16 + 10 = 26.

Why is one byte two hex digits?

A byte has 8 bits and each hex digit encodes 4 bits, so 00 to FF covers all 256 byte values.