Scientific calculator

Type the expression and read the answer, or tap the keypad. Trigonometry, logarithms, powers, factorials and percentages, with degrees or radians.

How Scientific Calculator works

This is a calculation, not a lookup: the expression is evaluated in the page and the steps are shown so the answer can be checked by hand. Because nothing is looked up remotely, the tool keeps working with the network off and cannot quietly change its answer between visits.

That is the whole architecture: static files, one script, no upload endpoint to leak or log. Close the tab and the work is gone.

No eval(), on purpose

A calculator that passes the input to eval() executes whatever it is given. On a page that also accepts pasted text, that is a code-execution hole. This one tokenises the expression, converts it to reverse Polish notation with a shunting-yard parser, and evaluates the stack itself.

Unknown characters are rejected with a message, so a pasted URL or a fragment of JavaScript produces an error instead of running.

The parts that are easy to get wrong

Unary minus: typing -5 has to mean zero minus five, not a broken operator, which is why the parser pushes a 0 before a leading minus. Precedence: ^ binds tighter than × and ÷, and groups left to right otherwise, except that it is right-associative so 2^3^2 is 512. Factorial: only defined for non-negative integers, and it returns NaN rather than a wrong number for anything else.

Angles are the other trap. sin(30) is 0.5 in degrees and −0.988 in radians; the selector switches the mode for the trig functions and their inverses only.

You typeYou get
2^3^2512 — right-associative
sin(30) in degrees0.5
5!120
log(1000)3
(2+3)*420 — parentheses first

Built for a keyboard

Type the whole expression and press Enter — the answer replaces it and the expression is pushed to the history list. The keypad exists for touch screens, not because typing is slower.

History is per tab and disappears when the page closes, which is the right default for a calculator that might be holding exam answers or salary figures.

Good to know

  • Works offline once loaded, including on flights and in locked-down networks.
  • No file size limit beyond your device's own memory.
  • Free to use, with no account and no usage counter.
  • Results are produced locally, so they are not logged or shared with anyone.

Questions

Does it use eval()?

No. The expression is tokenised and evaluated with a shunting-yard parser, so pasted text can never run as code.

How do degrees and radians work?

The selector switches sin, cos and tan (and the inverse functions) between the two modes. Everything else is unaffected.

What operators are supported?

+ − × ÷ ^ % ! and parentheses, plus sin cos tan asin acos atan log ln sqrt abs exp round and the constants pi and e.

Is there a memory key?

The history list keeps every result you confirm with =, so you can copy a previous answer back into the expression.

Keep going

More math tools