Scientific Calculator

Trig, logs, powers, roots, factorials. Click buttons or type.

0
-

Result

How to Use This Calculator

This scientific calculator handles everything a basic calculator cannot: trigonometry, logarithms, powers, roots, and factorials. Build your expression with the buttons or just type it on your keyboard, then press = or Enter.

1

Check the mode button: DEG means angles are in degrees (sin(30) = 0.5), RAD means radians. Tap it to switch.

2

Enter your expression with the buttons or keyboard. Functions like sin, log, and the square root insert an opening parenthesis for you.

3

Press = or Enter to evaluate. The expression and result are added to the history line above the display.

4

Made a typo? Backspace deletes one character, CE clears the last number you typed, and C clears the whole expression.

How It Parses Your Expression (No eval)

Cheap web calculators often run your input through JavaScript eval(), which executes it as code. That is a genuine security risk: a malicious input can run arbitrary script. This calculator never touches eval(). Instead it runs a real tokenizer that breaks your input into numbers, operators, parentheses, and function names, then a recursive-descent parser evaluates them with strict mathematical precedence. The bonus is better error messages: unbalanced parentheses tell you "Missing )" instead of silently failing.

Precedence, highest first: 1. Parentheses and functions: sin(30), sqrt(16) 2. Factorial and square: 5!, x^2 3. Powers, right to left: 2^3^2 = 512 4. Unary minus: -3^2 = -9 5. Multiplication and division, including implicit: 2pi, 3(4+5) 6. Addition and subtraction Trig: DEG mode treats angles as degrees, RAD mode as radians.

Worked Example

In DEG mode, type sin(30) and press =. The parser reads the function token sin, evaluates the argument 30, converts to radians internally (30 x pi / 180), and returns 0.5. Try a compound expression: sqrt(144)+2^3. The square root binds tightest: 12. Powers come next: 8. Addition last: 20. More checks you can run: cos(60) = 0.5, log(1000) = 3 (because 10^3 = 1000), ln(e) = 1, 5! = 5 x 4 x 3 x 2 x 1 = 120, 2^10 = 1024, and (2+3)*4 = 20. Implicit multiplication also works: 3(4+5) = 27 and 2pi = 6.2831853072.

Practical Tips

Most wrong answers on scientific calculators come from the mode, not the math. If sin(30) gives -0.988 instead of 0.5, you are in RAD mode. Switch to DEG. When mixing operations, parentheses are free and always win, so use them generously: (2+3)^2 is unambiguous while 2+3^2 means 11. Factorial only accepts non-negative whole numbers up to 170 (beyond that the result exceeds what floating point can hold). Log is base 10, ln is base e. Inverse trig functions return angles in your current mode, and asin/acos reject inputs outside -1 to 1 with a clear domain error.

Frequently Asked Questions

Should I use degree or radian mode?

Use DEG when your angles are in degrees (most school geometry and everyday problems: sin(30) = 0.5). Use RAD when working with calculus, physics formulas, or programming-style math, where angles are in radians (sin(pi/2) = 1). The toggle button shows the active mode, and inverse trig results (asin, acos, atan) are returned in the same mode.

Why does this calculator not use eval()?

Many web calculators evaluate expressions with JavaScript eval(), which executes arbitrary code and is a known security risk: a crafted input could run malicious script. This calculator instead uses a real tokenizer plus a recursive-descent parser, so input is only ever read as numbers, operators, and math functions. It is safer and it also gives clearer error messages, like "Missing )" instead of a blank screen.

What order of operations does it follow?

Standard mathematical precedence: parentheses and functions first, then factorial and square, then powers (right to left, so 2^3^2 = 512), then unary minus (so -3^2 = -9), then multiplication and division (including implicit multiplication like 2pi or 3(4+5)), then addition and subtraction last. When in doubt, add parentheses: they always win.

Which constants are available?

Two: pi (about 3.14159, inserted with the pi button or by typing pi) and e, Euler's number (about 2.71828). Both work in implicit multiplication, so 2pi means 2 times pi and 3e means 3 times e.

What keyboard shortcuts work?

Type digits, decimal point, plus, minus, star, slash, caret (^), parentheses, and exclamation mark directly. Enter evaluates, Backspace deletes the last character, and Escape clears everything. For functions, click the buttons or type the name followed by an opening parenthesis, for example sin(30).