Free Handy Tools

An expression calculator, not a keypad

This calculator evaluates a whole expression rather than one keystroke at a time. You type or build something like sin(30) + sqrt(16) × 2 and it is parsed, checked and evaluated as a unit — so brackets work, operator precedence works, and you can see and edit the whole expression before committing to it.

It covers the standard scientific set: the four operators, powers, square roots, factorials, base-10 and natural logarithms, the six common trigonometric and inverse trigonometric functions, absolute value, and the constants pi and e. Angles are read in degrees or radians, whichever mode is selected.

Precedence, associativity and a real gotcha

Multiplication and division bind tighter than addition and subtraction, so 2 + 3 × 4 is 14 and (2 + 3) × 4 is 20. Powers bind tighter still and are right-associative, which is the mathematical convention: 2^3^2 is 2^(3^2) = 512, not (2^3)^2 = 64.

One behaviour differs from written mathematics and is worth knowing before it surprises you: unary minus binds tighter than the power operator here, so −3^2 evaluates as (−3)^2 = 9, not −(3^2) = −9. Algebraic notation and several calculators read it the other way. If you mean the negative of a square, write it as 0 − 3^2 or −(3^2).

Worked results

sqrt(16) is 4. log(1000) is 3, because log is base 10 and ln is the natural logarithm — ln(e) is 1. Factorials are exact for whole numbers: 5! is 120 and 0! is 1.

In degree mode, sin(30) gives 0.5, asin(0.5) gives 30 and atan(1) gives 45. Floating-point trigonometry does not land exactly on these values — sin(30) actually computes to 0.49999999999999994 — so results are trimmed to twelve significant digits for display and values within 1e−12 of zero are snapped to zero, which is why sin(180) reads 0 rather than 1.22e−16.

Switch to radians and the same functions take and return radians: sin(pi) is 0, atan(1) is 0.7853981633974483.

What it refuses to do, and why

Expressions are parsed by a purpose-built tokeniser and shunting-yard evaluator, not by the JavaScript interpreter. That is a security decision as much as a correctness one: evaluating typed input with eval() would let a crafted expression run arbitrary code in your browser. Anything the parser does not recognise is rejected rather than guessed at.

Impossible operations produce a specific message instead of a silent NaN. log(0) and ln(0) are refused because the logarithm of zero is undefined; sqrt(−4) is refused because the result is not a real number; asin(2) and acos(2) are refused because the input must lie between −1 and 1; tan(90) in degrees is refused because the tangent is genuinely undefined there and floating point would otherwise return a very large finite number. Division by zero reports that the result is not finite. Factorials accept whole numbers from 0 to 170 — 170! is about 7.26e306, and 171! exceeds what a double-precision number can hold.

Scientific calculator questions

How do I switch between degrees and radians?

With the DEG and RAD buttons above the display. The mode applies to the trigonometric functions in both directions: in degree mode sin takes degrees and asin returns them. Getting this wrong is the most common cause of a trigonometric answer that looks nothing like the expected one.

Is log base 10 or base e?

log is base 10 and ln is base e, following the convention on most scientific calculators. For any other base, use the change-of-base identity: log base b of x is ln(x) ÷ ln(b).

Can I keep working from the last answer?

Yes. After pressing equals, an operator key continues from the result — so equals then + 5 adds five to what you just computed — while typing a digit starts a fresh expression instead of appending to the old one.

Why does 171! fail?

Because it overflows the double-precision floating-point format, which tops out near 1.8e308. Rather than returning Infinity, the calculator says the factorial is too large to represent, which is the honest answer.