Scientific Calculator
Calculators · Added 14 August 2026
Type a whole expression rather than pressing one key at a time — brackets, powers, trigonometric and inverse trigonometric functions, logarithms, roots, factorials and constants, in degrees or radians. The result previews as you type, and the session history lets you pull an earlier expression back for editing.
Expressions are parsed by a purpose-built parser, not by JavaScript’s eval. That distinction matters: eval would hand whatever you type to the JavaScript engine to run, which is a security hole on any page and especially on one that also loads third-party script. This parser only ever produces numbers — anything outside its grammar becomes an error message rather than an instruction. Operator precedence follows the standard convention, so −22 is −4 (the power binds tighter than the minus) and 2^3^2 is 512 (powers group right to left). Everything runs in your browser; nothing you type is sent anywhere.
How to use the scientific calculator
- 1Type an expression into the box, or build it with the keypad. Both work, and they mix freely.
- 2Switch between degrees and radians before using a trigonometric function — the mode changes the answer, not just the display.
- 3Press Enter or the = key to calculate. A live preview appears as you type, before you commit.
- 4Use the memory keys to store a value, recall it into an expression, or add and subtract from it.
- 5Click any entry in the session history to load that expression back for editing.
Examples
Order of operations
- Input
- 2 + 3 * 4 ^ 2
- Result
- 50
Powers first, then multiplication, then addition. The calculator follows standard precedence rather than left-to-right.
Trigonometry in degrees
- Input
- sin(30) with the mode set to degrees
- Result
- 0.5
The same expression in radians gives about −0.988. Check the mode before trusting a trigonometric result.
The unary minus rule
- Input
- -2^2
- Result
- -4
The power binds tighter than the minus, so this is −(2²). Enter (-2)^2 for 4. Spreadsheets and calculators agree on this and it still surprises people.
About the scientific calculator
Why a parser rather than eval
The shortest way to build a calculator on a web page is to pass the user's string to JavaScript's eval and print what comes back. It handles precedence, brackets and functions for free, and it is one line of code. It is also a serious mistake.
eval executes whatever it is given with the full privileges of the page. On a site that carries third-party script — advertising, for instance — that is an unnecessary hole, and the fact that a visitor would normally have to attack themselves to exploit it does not make it acceptable. Expression strings also travel: they get shared in links, pasted into bug reports, embedded in query parameters.
A hand-written parser costs more work and closes the question entirely. It tokenises the input, checks it against a fixed grammar, and evaluates a tree that can only ever yield a number. There is no path from a typed string to executed code, because the machinery to execute code was never involved. Anything the grammar does not recognise produces an error naming what it could not read.
Precedence, and the arguments it settles
Most disputes about what a calculator 'should' answer come down to precedence, and the conventions are less arbitrary than they look. Multiplication binds tighter than addition because it distributes over it. Exponentiation binds tighter than multiplication for the same structural reason. Powers group right to left — 2^3^2 is 2^(3^2), which is 512 rather than 64 — because that is the only grouping under which the notation composes meaningfully.
The unary minus is the one that catches people. Standard convention places it looser than exponentiation, so −2² is −4. This is not a quirk: it makes polynomial notation like −x² read correctly, which is how the convention arose. Every scientific calculator and spreadsheet behaves this way, and a calculator that answered 4 would be the odd one out.
Degree and radian modes are the other frequent source of surprise, and the mode is a property of the calculation rather than the display. sin(30) is 0.5 in degrees and about −0.988 in radians — not a rounding difference but a different question. The mode selector sits directly above the keypad for that reason, and inverse functions honour it in both directions, returning degrees when the mode is degrees.
Frequently asked questions
Does this use eval to calculate?
Why is -2^2 negative?
What is the difference between log and ln?
Does it support implicit multiplication?
Is anything I type sent anywhere?
Related tools
Percentage Calculator
Calculators
Five percentage calculations in one place — including percentage change and reverse percentages.
CGPA Calculator
Calculators
Work out a credit-weighted CGPA across any number of subjects, with optional percentage conversion.
Age Calculator
Calculators
Find an exact age in years, months and days from a date of birth — plus the next birthday countdown.