Math · Live
A scientific calculator,
that respects your inputs.
A free online scientific calculator with trigonometry, logarithms, exponents, square roots, parentheses, memory, and a calculation history. Built on a hand-written expression parser — every keystroke is validated against a fixed grammar, no eval, no surprises.
Field guide
How the scientific calculator works.
Every expression you type is run through a three-stage pipeline: a tokenizer breaks the string into atoms (numbers, operators, function names, parentheses), the shunting-yard algorithm converts the result into post-order, and an RPN evaluator computes the final value. Standard precedence rules apply, exactly like written math.
Operator precedence
From lowest to highest binding:
- +, −: addition, subtraction (left-associative)
- ×, ÷: multiplication, division (left-associative)
- ^: exponentiation (right-associative, so
2^3^2 = 2^(3^2) = 512) - Unary minus and function calls bind tighter than any of the above
- Parentheses override everything
Implicit multiplication
The calculator inserts a multiplication operator automatically between a number and a parenthesis, between a number and a function call, and between two adjacent parenthesised groups. So 2(3+1) = 8, 3sin(30) = 1.5 in degree mode, and (2)(3) = 6.
Supported functions
- sin(x)
- Sine of x. Argument in degrees or radians depending on the DEG/RAD toggle.
- cos(x)
- Cosine of x. Same angle-unit rule as sin.
- tan(x)
- Tangent of x. Returns Error near 90°, 270°, etc., where the function diverges.
- asin(x)
- Inverse sine. Domain −1 ≤ x ≤ 1. Output in the active angle unit.
- acos(x)
- Inverse cosine. Domain −1 ≤ x ≤ 1.
- atan(x)
- Inverse tangent. Defined for all real x.
- log(x)
- Common logarithm (base 10). Domain x > 0.
- ln(x)
- Natural logarithm (base e). Domain x > 0.
- sqrt(x)
- Square root. Domain x ≥ 0; for negatives the calculator returns Error.
- exp(x)
- Exponential function eˣ. Defined for all real x.
- abs(x)
- Absolute value of x — its distance from zero on the number line.
- x ^ y
- Power: x raised to y. Uses the ^ operator; right-associative.
Constants
- π: pi, the ratio of a circle's circumference to its diameter (≈ 3.14159265).
- e: Euler's number, the base of natural logarithms (≈ 2.71828183).
Degrees vs radians
The toggle in the top-left of the display switches the unit for trig functions. In DEG mode, sin(30) = 0.5; in RAD mode, sin(30) ≈ −0.988 because 30 radians is many full rotations. Inverse functions follow the same rule: asin(0.5) = 30 in DEG, ≈ 0.5236 (= π/6) in RAD.
Memory functions
- M+: evaluate the current expression and add it to the memory register.
- M−: evaluate and subtract from memory.
- MR: recall: insert the memory value into the current expression at the cursor.
- MC: clear memory back to zero.
Whenever memory holds a non-zero value the display shows an M badge in the top-left corner.
History
The right-hand panel keeps the last 10 evaluations. Tapping any entry recalls its expression into the active input, ready to edit and re-evaluate. History clears with the dedicated Clear button or when you reload the tab — nothing leaves the browser.
Live preview
While you type, the smaller line above the main display shows the running value of a partially complete expression (= 12.5) when one is unambiguous. It vanishes once you press =; from then on, the smaller line displays the original expression and the larger one shows the answer.
Keyboard shortcuts
- Digits: type 0–9 directly.
- + − * /: operators (* and / are auto-displayed as × ÷).
- ^: exponentiation.
- ( ): parentheses.
- Enter or =: evaluate.
- Backspace: delete last character.
- Escape or Delete: clear all.
Worked examples
Right-triangle side from a 5 m hypotenuse and a 30° angle: 5 × sin(30) = 2.5 (DEG mode).
Compound annual growth of $1,000 at 7% over 10 years: 1000 × 1.07 ^ 10 ≈ 1967.15.
Quadratic formula root for x² − 5x + 6 = 0: (5 + sqrt(25 − 24)) ÷ 2 = 3.
What this calculator doesn't do
We deliberately stop at single-variable scalar arithmetic. Symbolic algebra (factor, simplify, integrate), matrix operations, complex numbers, statistical functions, and programming-mode arithmetic (binary, hex) are out of scope — for those, use a CAS such as Wolfram or SymPy.
Disclaimer
JavaScript's IEEE-754 double precision means some arithmetic loses a few digits at the end (0.1 + 0.2 = 0.30000000000000004). For most everyday and educational use this is invisible, but if you need exact-rational answers, a symbolic system is the right tool.