Math Expression Evaluator

Evaluate math expressions safely — supports arithmetic, trig, logarithms, parentheses, and constants.

Quick Reference
+ - * / % ^Arithmetic & powersqrt, absSquare root, absolutesin, cos, tanTrigonometry (radians)log, lnLog base 10, natural logceil, floor, roundRounding functionsmin(a,b), max(a,b)Min & maxpi, eConstants

Frequently Asked Questions

It supports addition (+), subtraction (-), multiplication (*), division (/), exponentiation (^), modulo (%), parentheses, and functions like sqrt, sin, cos, tan, log (base 10), ln (natural log), abs, ceil, floor, round, min, and max. Constants pi and e are also available.
No. This evaluator uses a safe, custom-built recursive descent parser. JavaScript's eval() is never called, making it safe to use with arbitrary input — there is no risk of code injection.
The evaluator follows standard mathematical order: parentheses first, then functions, then exponentiation (right-associative), then multiplication/division/modulo, and finally addition/subtraction.
Use comma-separated arguments inside parentheses: min(3, 7) returns 3, max(10, 20) returns 20. Single-argument functions like sqrt(16) or sin(pi/2) work with one value.
Trigonometric functions (sin, cos, tan) use radians. To convert degrees to radians, multiply by pi/180. For example, sin(30 * pi / 180) calculates the sine of 30 degrees.