Math Expression Evaluator
NewEvaluate mathematical expressions safely — supports arithmetic, trig, logs, sqrt, and more.
Safe expression parser
Math Expression Evaluator
Evaluate mathematical expressions safely — supports arithmetic, trig, logs, sqrt, and more.
Supports + - * / ^ % sqrt() sin() pi n! and more.
Result
Enter an expression to calculate.
History
Last 10No calculations yet.
Frequently Asked Questions
Is this using JavaScript eval under the hood?
No. It uses a custom parser with separate expression, term, power, unary, postfix, and primary parsing steps. That means it only supports the operators and functions explicitly coded into the parser.
Why does sin(90) not return 1?
Because the trig functions come straight from JavaScript's Math object, which uses radians. For 90 degrees, use sin(pi/2) instead.
What functions and operators are actually supported?
The parser handles +, -, *, /, %, ^, parentheses, unary +/-, postfix factorial, constants pi and e, and single-argument functions sqrt, abs, floor, ceil, round, sin, cos, tan, log, and exp. Anything outside that list is rejected as an unknown function or token.
Why does 2(3+4) or 1e3 fail?
This parser does not implement implicit multiplication or scientific-notation numbers. You need to write 2*(3+4), and exponent notation like 1e3 isn't recognized by its number parser.
Why does factorial fail on values like 5.5 or -1?
Because factorial is deliberately limited to non-negative integers. If the value isn't an integer or is below zero, the tool throws a specific factorial error instead of approximating it.
Related Tools
Date Difference Calculator
Calculate the exact difference between two dates in days, months, years, and more.
Prime Number Tools
NewCheck if a number is prime, find primes up to N, prime factorization, and nearest prime finder.
Percentage Calculator
NewCalculate percentages, percent change, and percent increase/decrease instantly.