Hex CalculatorFree online math calculator — instant results, no sign-up
Hexadecimal arithmetic and conversion.
About the Hex Calculator
The Hex Calculator performs basic arithmetic on two hexadecimal (base-16) numbers and displays the outcome in both hexadecimal and decimal notation. It is commonly used by software developers, computer engineers, and students working with memory addresses, color codes, and low-level byte manipulations.
- Hex A
- The first hexadecimal operand, written using digits 0–9 and letters A–F (case-insensitive).
- Op
- The arithmetic operation to perform: addition (+), subtraction (−), multiplication (×), or division (÷).
- Hex B
- The second hexadecimal operand, written using digits 0–9 and letters A–F (case-insensitive).
Formula and method
r = a [op] b, where a = parseInt(Hex A, 16) and b = parseInt(Hex B, 16). For division: r = floor(a / b).
- aDecimal integer value of Hex A
- bDecimal integer value of Hex B
- rCalculated decimal result
- Hex resultValue of r converted back to base-16 (uppercase)
Both input hex strings are converted into base-10 integers using JavaScript's parseInt function. The selected operation is evaluated in decimal, with division truncated downward to the nearest integer using Math.floor. The final integer is converted back to an uppercase hexadecimal string and also reported directly in decimal.
Worked example
These are the calculator's starting values and the results it actually produces for them.
Inputs
- Hex AFF
- Op+
- Hex B1A
Results
- Hex result119
- Decimal result281
How to use the Hex Calculator
- 1Parse Hex A and Hex B from base-16 representations to base-10 integers.
- 2Execute the specified arithmetic operation (+, −, ×, or integer division ÷).
- 3Format the resulting integer into uppercase hexadecimal notation.
- 4Display both the hexadecimal representation and the corresponding base-10 decimal value.
Reading your result
The 'Hex result' shows the base-16 representation of the computation, using digits 0–9 and letters A–F. The 'Decimal result' provides the equivalent value in standard base-10 notation, allowing for quick cross-base verification.
Limitations
The calculator implements integer division using floor truncation; it does not yield fractional or floating-point hex values. It does not represent signed values using two's complement notation (negative results simply carry a minus sign), nor does it enforce fixed word sizes such as 8-bit, 16-bit, or 32-bit overflows.
Common questions
How does division handle remainders?+
Division uses integer floor truncation (Math.floor), meaning any fractional remainder is discarded rather than rounded or represented as a hex fraction.
Are lowercase hex digits supported?+
Yes. Inputs can use lowercase letters (a–f) or uppercase letters (A–F); the calculator processes them identically and returns uppercase output.
How are negative results displayed?+
Negative numbers are displayed with a standard leading minus sign (such as -1A) rather than binary two's complement byte formats.
Does the calculator save my information?+
Calculations run in your browser. While signed in, inputs and results are automatically recorded in account history; saving a result creates a separate saved record.
Further reading
You might also like
Scientific Calculator
Full scientific calculator with trig, logs, powers, memory and degree/radian modes.
Fraction Calculator
Add, subtract, multiply and divide fractions.
Percentage Calculator
Percent of a number, what percent, and percent change.
Random Number Generator
Generate random integers in a range.
Percent Error Calculator
Error between an observed and true value.
Exponent Calculator
Raise a base to any power.
Results are estimates for informational purposes and are not financial, medical or legal advice.