Sumivo · Mathematics

Hex Calculator

Add, subtract, multiply and divide two hexadecimal numbers, with every result shown in both hex and decimal. Exact arithmetic on whole hex numbers.

01 / inputs

hex
hex

02 / result

A + B (HEX)

C4

A (decimal)
165
B (decimal)
31
Sum (A + B)
C4₁₆ = 196
Difference (A − B)
86₁₆ = 134
Product (A × B)
13FB₁₆ = 5115
Quotient (A ÷ B)
5₁₆ r A₁₆ = 5 r 10

Calculation trace

  1. A5₁₆ = 165₁₀
    0
    Operand A to decimal
  2. 1F₁₆ = 31₁₀
    0
    Operand B to decimal
  3. 165 + 31 = 196 = C4₁₆
    0
    Add
  4. 165 − 31 = 134 = 86₁₆
    0
    Subtract
  5. 165 × 31 = 5115 = 13FB₁₆
    0
    Multiply
  6. 165 ÷ 31 = 5 remainder 10 = 5₁₆ r A₁₆
    0
    Divide (integer)
§

How it works

Each hexadecimal digit is a power of sixteen, so A5 in base 16 is 10×16 + 5×1 = 165 in base 10 (the digits A–F stand for 10–15). The tool reads both operands that way, does the arithmetic on the whole numbers, and converts the answer back to hexadecimal. Addition, subtraction, and multiplication follow the ordinary rules on the decimal values; division is integer division, giving a whole-number quotient and a separate remainder (for example A5 ÷ 1F is 165 ÷ 31 = 5 remainder 10, shown as quotient 5 and remainder A). All of this runs on exact big integers, so results stay precise no matter how large the numbers get, unlike ordinary floating-point which loses precision past 2^53.

Assumptions & limits

  • Operands must contain only the hex digits 0–9 and A–F (case-insensitive; an optional 0x prefix and leading zeros are allowed); anything else is rejected.
  • Division is integer division: it returns a quotient and a remainder, not a hex fraction.
  • A − B can be negative; it is shown with a minus sign rather than a two’s-complement pattern, because two’s complement needs a fixed bit width that a plain calculator does not assume.
  • Inputs are capped at 32 hex digits each (128 bits) to keep the page responsive.
§

FAQ

How do I add two hexadecimal numbers?
Enter both numbers in hex and read the Sum row. For example A5 + 1F = C4, which is 165 + 31 = 196 in decimal. The tool shows every result in both hexadecimal and decimal.
How does hex division work here?
It is integer division. A5 ÷ 1F is 165 ÷ 31 = 5 with remainder 10, shown as quotient 5 and remainder A in hex. It does not produce a hexadecimal fraction.
Can I enter lowercase letters or a 0x prefix?
Yes. Lowercase a–f and an optional 0x prefix are accepted, and leading zeros are ignored, so 0x0ff and FF are read as the same value. Results are displayed with uppercase A–F.
Is the result exact for very large hexadecimal numbers?
Yes. The arithmetic uses arbitrary-precision integers, so a 64-bit or 128-bit operand is computed exactly — no rounding of the kind ordinary floating-point introduces beyond 2^53.
§

Related calculators

§

SOURCES