Scientific calculator
Type any maths expression and get the answer instantly. It supports trigonometry, logarithms, square roots, powers, factorials, parentheses, and the constants pi and e — a full replacement for a handheld scientific calculator, right in the browser.
A parser, not an eval
You type a complete expression rather than pressing one button at a time. The
input is read by a safe custom parser that respects standard operator
precedence (powers before multiplication and division, those before addition and
subtraction) and parentheses. It never uses JavaScript eval, so a typo can only
produce an error, never run code. A degrees/radians toggle controls how the trig
functions interpret their inputs.
Supported tokens:
| Category | Tokens |
|---|---|
| Operators | + − × ÷ ^ (power) ! (factorial) |
| Functions | sin, cos, tan, asin, acos, atan |
| ln, log, sqrt, abs, exp | |
| Constants | pi, e |
Example expressions
With the degrees toggle on, entering (3 + 4) * sqrt(16) - log(100) evaluates as
7 × 4 − 2 = 26. Switch to radians and sin(pi / 2) returns 1.
Here are more worked examples — all of these parse correctly in the calculator:
| Expression | Result | Notes |
|---|---|---|
2^10 | 1024 | Two to the power of ten |
sqrt(144) | 12 | Square root |
ln(e^3) | 3 | Natural log and exp cancel |
log(1000) | 3 | Base-10 log |
5! | 120 | Factorial |
abs(-7.5) | 7.5 | Absolute value |
sin(90) | 1 | Degrees mode |
cos(pi) | -1 | Radians mode |
exp(1) | 2.71828… | Same as e^1 |
asin(1) * 2 | 90 (degrees) | Inverse sine × 2 |
Practical tips
Degrees vs radians. Switch the toggle before entering trig expressions — this is the single most common source of wrong answers. In degrees, sin(90) is 1; in radians, sin(90) is approximately 0.894 (because 90 radians is not a right angle).
Order of operations. The parser follows standard BODMAS/PEMDAS. Powers are evaluated first, then multiplication and division, then addition and subtraction. Use parentheses liberally when in doubt: 2 + 3 * 4 is 14, while (2 + 3) * 4 is 20.
Factorial limits. Very large factorials like 50! produce numbers with many digits that may display in scientific notation or overflow standard floating-point precision. Results up to around 20! (about 2.4 × 10^18) are exact; beyond that, expect floating-point rounding.
Chaining functions. You can nest functions freely: sqrt(abs(-16)) is valid and returns 4. The parser handles any depth of nesting as long as brackets are balanced.
Degrees and radians: the conversion in your head
The two units measure the same angles on different scales: a full circle is
360° or 2π radians, so 1 radian ≈ 57.2958° and radians = degrees × π/180.
The anchor values worth memorising:
| Degrees | Radians | sin | cos |
|---|---|---|---|
| 0° | 0 | 0 | 1 |
| 30° | π/6 | 0.5 | √3/2 |
| 45° | π/4 | √2/2 | √2/2 |
| 60° | π/3 | √3/2 | 0.5 |
| 90° | π/2 | 1 | 0 |
| 180° | π | 0 | −1 |
Mathematics, physics and programming libraries default to radians (JavaScript’s
own Math.sin takes radians only); surveying, navigation and everyday problems
use degrees. If an answer looks wildly wrong, the toggle is the first thing to
check.
Why some results show a tiny error
Like virtually every computer and handheld calculator, this tool computes with
IEEE 754 double-precision floating point — the binary number format documented
in MDN’s Number reference.
Doubles — specified by the
IEEE 754 standard — carry
about 15–17 significant decimal digits, and some decimal values
(famously 0.1) have no exact binary representation, which is why
0.1 + 0.2 computes internally to 0.30000000000000004. Consequences you may
notice:
- Results are trustworthy to ~15 significant digits; digits beyond that are noise.
sin(pi)in radians returns a value like1.2e-16rather than exactly 0 — that is zero to machine precision.- Integers are exact up to 2⁵³ (about 9 × 10¹⁵); factorials beyond
18!cross that line and round.
None of this is a bug in any particular calculator — it is the arithmetic all mainstream hardware uses, and knowing the ~15-digit limit tells you exactly how far to trust any digital calculation.
Typing expressions faster
A few input habits that save time: multiplication accepts both * and ×, and
division accepts / and ÷, so you can type entirely from the keyboard.
Constants compose naturally with operators — 2*pi*6371 gives Earth’s
circumference in kilometres from its radius. Inverse trig results respect the
degrees toggle, so atan(1) reads 45 in degrees mode and 0.7853… (π/4) in
radians. And because the whole expression is visible at once, you can edit any
part of it and re-evaluate instantly — the main workflow advantage over a
button-at-a-time handheld.
Everything runs locally in your browser, so nothing you type is uploaded.