Too Much Tools logoToo Much Tools

Math Evaluator

Evaluate math expressions with functions and constants, locally (no eval).

Local, Runs entirely in your browser, your data never leaves your device.
Loading tool…

Evaluate expressions without eval

This tool parses an arithmetic expression with a small recursive-descent parser and computes the result, instead of running it through JavaScript's eval. It covers the operators you'd type by hand, plus common functions like sqrt, sin and log and constants like pi and e, which makes it useful for a quick unit conversion or a formula check without opening a spreadsheet. Everything runs locally in the input field, so nothing you type leaves the page.

How to use the Math Evaluator

  1. Type an expression into the field, such as sqrt(16) + 2 ^ 3 or sin(pi / 2).
  2. Click one of the example chips below the field to load a ready-made expression.
  3. Read the live result to the right of the equals sign as you edit the expression.
  4. Use nested parentheses and function calls like max(3, 7, 2) or log(1000, 2) freely.
  5. Copy the result with the copy button once the expression evaluates without an error.

Operator precedence, low to high, is addition and subtraction, then multiplication, division and modulo, then unary plus/minus, then the caret exponent operator, which is right-associative so 2^3^2 evaluates as 2^(3^2).

Trigonometric functions expect radians, not degrees, so sin(90) is not 1, sin(pi / 2) is. log(x) is base 10 unless you pass a second argument as the base, such as log(8, 2) for base-2 log.

Frequently asked questions

Does this use JavaScript's eval() function?
No. The expression is tokenized and parsed by hand into a small recursive-descent evaluator that only recognizes numbers, operators, parentheses, and the listed function and constant names, so arbitrary code can't run.
What functions and constants are supported?
sqrt, cbrt, abs, round, floor, ceil, sign, exp, ln, log, log2, sin, cos, tan, asin, acos, atan, atan2, min, max, pow, hypot and root, plus the constants pi, e, tau and phi.
Are trig functions in degrees or radians?
Radians, matching JavaScript's Math object underneath. To evaluate an angle given in degrees, convert it first, for example sin(90 * pi / 180) for a 90-degree angle.
What happens if I divide by zero or enter an invalid expression?
Dividing by zero returns Infinity or NaN like standard floating-point math, and a malformed expression, unknown function name, or unbalanced parenthesis shows a specific parse error instead of a result.