Format Code Now
/
ConvertHex Calculator Next: Bytes Converter ›

Hex Calculator

CV-28

Type a hex expression such as FF + 1A and get the result in hex and decimal: 0x119 and 281. It adds, subtracts, multiplies and divides, with a remainder for division.

Runs in your browser. Nothing is uploaded.

Hex expressions (one per line, such as FF + 1A)

Results

How to use it

  1. Type one operation per line, such as FF + 1A, 0x100 - 1 or FF * 10.
  2. Use + - * / or %. A number can start with a minus sign and can have a 0x prefix.
  3. Choose whether results show 0x and whether hex digits are uppercase.
  4. Click Calculate and read each result in hex and decimal.
  5. Copy the result or download it as a text file.

What it calculates

Each line has two hex numbers and one operator. FF + 1A is 0x119, which is 281 in decimal. Division is whole-number division, so FF / 10 gives 0xF with a remainder of 0xF, which is 15 and 15 in decimal. The % operator gives only the remainder. Results are shown in hex and in decimal on the same line, so you can check one against the other.

No size limit

Numbers are handled as BigInt, so there is no rounding and no 32-bit or 64-bit overflow. You can multiply two 40 digit hex numbers and get the exact product. The only limit is your browser memory. Hex digits are not case sensitive on input, and the 0x prefix is optional, so ff and 0xFF are the same number.

Negative numbers and limits

A leading minus sign makes a number negative, and results can be negative, written as -0x5 or -5. Division truncates toward zero, and the remainder takes the sign of the first number, so -7 / 2 gives -3 with remainder -1. Fractions, brackets, several operations on one line and bit operations are not supported. For bit operations, use the bitwise calculator.

Error messages and what to do

MessageWhat it meansFix
Could not read "FF". Write one operation per line, such as FF + 1A, with + - * / or %.The line is not two hex numbers with an operator between them.Write the two numbers and one operator, such as FF + 1A.
Cannot divide by zero.The second number in a division or remainder is 0.Use a divisor that is not zero.

Questions people ask

How do I add hexadecimal numbers?

Type them with a plus sign, such as FF + 1A, and click Calculate. The result is 0x119, which is 281 in decimal. Carries work the same way as in decimal, but in base 16.

How do I divide hex numbers?

Use a slash. FF / 10 gives 0xF with a remainder of 0xF. Division is whole-number division, so there is no fractional part, and the remainder is shown beside the quotient.

Can it handle very large hex values?

Yes. It uses BigInt arithmetic, so large values are exact and are not rounded to 64 bits. Very long numbers only slow down as your browser works through them.

Does it accept the 0x prefix?

Yes, and it is optional. 0xFF, FF and ff are all 255. You can turn the 0x off in the results with the Show 0x option.

How are negative results written?

As a minus sign followed by the hex value, for example FF - 100 gives -0x1 and -1 in decimal. It does not use two's complement. For that, use the bitwise calculator with a bit width.

What is FF in decimal?

255. F is 15, so FF is 15 times 16 plus 15. The calculator shows the decimal value beside each hex result, so you can check conversions too.

About this tool

One operation per line with two hex numbers and one of + - * / or %. Numbers may start with a minus sign and may have a 0x prefix. Everything uses BigInt, so there is no size limit short of your browser memory and no rounding. Division is whole-number division that truncates toward zero and shows the remainder; the remainder takes the sign of the first number. The % operator gives only the remainder. Fractions, hex digits after a point, brackets, chained operations such as 1 + 2 + 3 and bit operations are not supported here (use the bitwise calculator for those).

Format Code Now: free, no ads, no accounts. Your input stays in your browser.