Math evaluator
A calculator for evaluating mathematical expressions. You can use functions like sqrt, cos, sin, abs, etc.
About Math evaluator
Evaluates a mathematical expression as you type, with the functions and constants of the math.js library: arithmetic, powers, roots, trigonometry, logarithms, factorials, unit conversions and more.
When you would use it
- Quick calculations without opening a calculator app: 1920/1080, 2^32, sqrt(2)*10.
- Trigonometry and logarithms with proper functions: sin(pi/4), log(1000, 10), atan2(1, 1).
- Converting units inline: 5 inch to cm, 100 km/h to m/s, 72 degF to degC.
How to use it
- Type an expression in the field.
- Read the result below it; errors are shown while the expression is incomplete.
- Copy the result.
Things worth knowing
- Standard operator precedence applies: ^ binds tighter than * and /, which bind tighter than + and −. Use parentheses when in doubt.
- Trigonometric functions take radians. Write sin(45 deg) or sin(45 * pi / 180) for degrees.
- log(x) is the natural logarithm; use log10(x) or log(x, 10) for base 10. The factorial is 5! and the modulo is mod or %.
- Numbers are IEEE double precision, so 0.1 + 0.2 shows 0.30000000000000004. Use round(x, 2) to round to two decimals.
Frequently asked questions
- Why does 0.1 + 0.2 not give exactly 0.3?
- Binary floating point cannot represent 0.1 or 0.2 exactly, a limitation of nearly every calculator and programming language. Wrap the expression in round(..., 2) to display a clean result.
- Can I convert units?
- Yes, math.js understands many units: write a value with its unit and to followed by the target unit, for example 3 ft to m or 1 GB to MB.