Scientific Calculator
Type a whole expression rather than pressing one key at a time: 2*sin(45) + log(100) + sqrt(16) evaluates as written. Trigonometry works in degrees or radians, and when something is wrong you are told which bracket or name caused it instead of getting a bare error.
Enter an expression
How to use this calculator
- Type the whole expression rather than pressing one key at a time —
2*sin(45) + log(100)works as written. - Set Degrees or Radians before you calculate. It changes what sin, cos and tan mean.
- Press Calculate. The last ten results are kept below the form.
What it understands
Operators — + − * / % (remainder) and ^ (power), with the usual precedence and brackets to override it. Powers are right-associative, so 2^3^2 is 29 = 512, not 64.
Functions — sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, ln, log (base 10), log2, sqrt, cbrt, abs, exp, floor, ceil, round, sign.
Constants — pi and e.
Numbers — ordinary decimals and scientific notation such as 2.5e-3.
Note that a leading minus binds less tightly than a power, following normal mathematical convention: -2^2 is −4, because it means −(2²). Write (-2)^2 for 4.
How the expression is evaluated
The expression is broken into tokens, converted to postfix form with the shunting-yard algorithm, and evaluated on a stack. It is never handed to the browser's JavaScript engine.
That matters for safety as much as correctness. Passing whatever someone types into eval is a well known way to let a page run arbitrary code, and this site's Content-Security-Policy forbids it outright. A real parser also lets the calculator give a useful message — which bracket is unmatched, which name it did not recognise — instead of a generic syntax error.
Frequently Asked Questions
Why does sin(45) give a different answer than I expected?
Almost always the angle mode. In Degrees, sin(45) is about 0.7071; in Radians it is about 0.8509. The mode is shown with every result so you can check which one was used.
How do I calculate logarithms in a different base?
log is base 10 and ln is base e, with log2 provided for base 2. For any other base use the change of base rule: log base b of x equals ln(x) divided by ln(b). For example log base 3 of 81 is ln(81)/ln(3), which is 4.
How do I enter powers and roots?
Use ^ for powers, so 2^10 is 1024. For roots use sqrt for square roots and cbrt for cube roots, or a fractional power: x^(1/5) is the fifth root of x. Remember the brackets around the fraction.
Why is -2^2 equal to -4 and not 4?
Because a power binds more tightly than a leading minus sign, so -2^2 means -(2 squared). This is the standard mathematical convention and matches what most textbooks and programming languages do. Write (-2)^2 if you want 4.
Can I use scientific notation?
Yes. Write 2.5e-3 for 0.0025 or 1e6 for a million. Very large and very small results are returned in the same form.
