Expression Calculator
Evaluate math expressions safely (no eval): arithmetic, trigonometry, logarithms, factorials, powers, roots, percentages, and constants (pi, e, tau). Supports parentheses, memory variables, and step-by-step trace.
About this tool
Type a math expression and get the answer instantly, with a step-by-step trace showing how it was evaluated. The calculator handles arithmetic, powers, roots, factorials, percentages, trigonometric and logarithmic functions, and constants such as pi, e, and tau. Parentheses and operator precedence follow standard math rules, and ans lets you chain the previous result into the next expression.
Example: 2 + 3 * 4 → 14 (multiplication first). 5! + 2^3 → 128 (120 + 8). sin(pi/4)^2 + cos(pi/4)^2 → 1 (the Pythagorean identity). 100 * 15% + 100 → 115 (a 15% add-on).
The percentage operator behaves intuitively: 50% means 0.5, so 200 * 8% gives 16 (8 percent of 200). For modulo use the word mod, e.g. 17 mod 5 → 2.
FAQ
Does this use eval()? ›
No. The expression is parsed by a shunting-yard algorithm into reverse Polish notation and then evaluated against an explicit allow-list of functions and constants. There is no eval(), no new Function(), and no way to execute arbitrary code.
What does the "ans" button do? ›
It inserts the last computed result, so you can continue a calculation: evaluate 2 + 3 to get 5, then type "ans * 4" to get 20 without retyping the value.
How big a factorial can it compute? ›
Up to 170!, which is the largest factorial that fits in a 64-bit floating-point number (about 7.26 × 10³⁰⁶). 171! overflows to Infinity and the tool reports an error.
What is the difference between log and ln? ›
log is base-10 (the common logarithm), ln is the natural logarithm (base e). Use log2 for base-2. exp(x) returns e raised to the power x.