Hex Calculator

Enter two hex numbers and choose an operation.

Operation

AND, OR and XOR compare the numbers digit by digit.

Digits 0–9 and A–F, with an optional 0x; a leading minus sign is allowed.

Digits 0–9 and A–F, with an optional 0x; a leading minus sign is allowed.

Try

Result

You enteredFF16 ÷ 1016\mathrm{FF}_{16}\ \div\ \mathrm{10}_{16}

FF16 ÷ 1016=F16 remainder F16\displaystyle \mathrm{FF}_{16}\ \div\ \mathrm{10}_{16} = \mathrm{F}_{16}\ \text{remainder}\ \mathrm{F}_{16}

Decimal

255÷16=15 remainder 15\displaystyle 255 \div 16 = 15\ \text{remainder}\ 15

Binary

11112 remainder 11112\displaystyle \mathrm{1111}_{2}\ \text{remainder}\ \mathrm{1111}_{2}
Show the work
  1. Hex to decimal

    Each hex digit is worth a power of 1616, counting from 00 at the right, with A to F standing for 10 to 15. Converting both numbers to decimal lets the operation be done with ordinary arithmetic.

    Using N=dk 16k+⋯+d1 16+d0N = d_{k}\,16^{k} + \cdots + d_{1}\,16 + d_{0}

    FF16=15×161+15×160=240+15=2551016=1×161+0×160=16+0=16\begin{gathered} \mathrm{FF}_{16} = 15 \times 16^{1} + 15 \times 16^{0} = 240 + 15 = 255 \\ \mathrm{10}_{16} = 1 \times 16^{1} + 0 \times 16^{0} = 16 + 0 = 16 \end{gathered}
  2. Division with a remainder

    Dividing a=255a = 255 by b=16b = 16 gives a whole-number quotient qq and a remainder rr that is smaller than the divisor in size.

    Using a=b×q+ra = b \times q + r

    255=16×15+15255 = 16 \times 15 + 15
  3. Decimal to hex

    Write the quotient and the remainder in hex.

    15=F1615=F16\begin{gathered} 15 = \mathrm{F}_{16} \\ 15 = \mathrm{F}_{16} \end{gathered}
  4. Result

    So FF16 ÷ 1016\mathrm{FF}_{16}\ \div\ \mathrm{10}_{16} gives quotient F16\mathrm{F}_{16} and remainder F16\mathrm{F}_{16}.

Worked examples