Math Evaluator
Evaluate one or more mathematical expressions, one per line. Supports arithmetic, functions (sqrt, sin, cos, log), units (deg), and matrices via mathjs. Each line is evaluated independently and errors are reported per line.
Input
Output
Guides
The Math Evaluator computes the value of mathematical expressions directly in your browser. Type one expression per line and each is evaluated independently — so a mistake on one line never breaks the rest. It is powered by mathjs, a rich expression engine that understands far more than a basic calculator, while staying safe: it parses a restricted math syntax, not arbitrary JavaScript, so nothing you type can execute code.
How to use it
- Enter one or more expressions in the input box, one per line.
- The result for each line appears in the output box as
expression = result. - If a line can't be evaluated, you get a
Line N: <reason>message pinpointing exactly which line failed and why.
Copy or download the results with the buttons on the output box.
Supported syntax
The evaluator understands a wide range of mathematical notation:
- Arithmetic —
+,-,*,/,%(modulo), and^for exponents:3^2 + 4^2→25. - Parentheses and precedence —
(2 + 3) * 4→20. - Roots and powers —
sqrt,cbrt,pow,nthRoot:2*sqrt(6). - Trigonometry —
sin,cos,tan,asin,acos,atan, and their hyperbolic variants. Combine with thedegunit to work in degrees:sin(45 deg). - Logarithms —
log,log2,log10,exp. Note thatlog(x, base)is the logarithm ofxin the givenbase, solog(10, 100)=0.5(that is, ln 10 ÷ ln 100). For the base-10 log of 100, writelog10(100)orlog(100, 10)→2. - Constants —
pi,e,phi,tau,Infinity. - Rounding & number theory —
round,floor,ceil,abs,gcd,lcm,factorial, and the!operator. - Units — attach units like
deg,rad,cm,inch,kg; mathjs converts between compatible ones (e.g.5 cm + 2 inch). - Matrices and vectors — build them with
matrix([[1,2],[3,4]])or the bracket shorthand[1, 2; 3, 4], then multiply, transpose, or take the determinant:matrix([[1,2],[3,4]]) * [5,6]→[17, 39]. - Variables — assign with
x = 5and reuse the name on later lines.
Examples
| Expression | Result |
|---|---|
2*sqrt(6) |
4.898979486 |
sin(45 deg) + cos(45 deg) |
1.414213562 |
3^2 + 4^2 |
25 |
matrix([[1,2],[3,4]]) * [5,6] |
[17, 39] |
Is my input sent anywhere?
No. Every expression is evaluated locally in your browser — nothing is uploaded to a server, which makes the tool fast and private.
Why does one line show an error while the others still work?
Each line is evaluated on its own. An unknown function, an undefined symbol, or a syntax slip only affects that single line; the valid lines around it still return their results.