Skip to content
ToolBoxGenie

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.

Type directly, or use the keypad. Enter calculates.
Angle mode
memory empty

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

  1. 1Type an expression into the box, or build it with the keypad. Both work, and they mix freely.
  2. 2Switch between degrees and radians before using a trigonometric function — the mode changes the answer, not just the display.
  3. 3Press Enter or the = key to calculate. A live preview appears as you type, before you commit.
  4. 4Use the memory keys to store a value, recall it into an expression, or add and subtract from it.
  5. 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?
No, and deliberately not. Expressions are parsed by a purpose-built parser that recognises a fixed grammar and only ever produces numbers. Using JavaScript's eval would hand whatever you type to the engine to execute, which is a security hole on any page and particularly on one that also loads third-party advertising script. Anything outside the grammar becomes an error message rather than an instruction.
Why is -2^2 negative?
Because exponentiation binds more tightly than a leading minus, so the expression means −(2²) rather than (−2)². This is the standard mathematical convention and what spreadsheets and scientific calculators do. If you want the square of negative two, bracket it explicitly as (-2)^2.
What is the difference between log and ln?
On this calculator log is base 10 and ln is the natural logarithm, base e. log2 is also available for base 2. Conventions differ by field — in much of mathematics 'log' means the natural logarithm — so the buttons are labelled explicitly to remove the ambiguity.
Does it support implicit multiplication?
Yes. 2(3+4) means 2 × (3+4), and 3pi means 3 × π. This matches how expressions are written on paper. Where it could be ambiguous, brackets are always safe and always respected.
Is anything I type sent anywhere?
No. The parser runs entirely in this browser tab, and the session history is held in memory only — it is never written to storage and disappears when you close or reload the page.