Basic Calculator

A simple, fast online calculator for addition, subtraction, multiplication and division. It supports parentheses and applies standard operator precedence (multiplication and division before addition and subtraction), so expressions like 3 + 4 × 2 evaluate correctly to 11.

Enter an expression

Use + − × ÷ ( ) and decimal numbers. You can also type *, / and ^ (for powers).

Enter an expression and press Calculate.

How the calculator works

The calculator parses your expression into a small syntax tree, then evaluates it left-to-right while respecting operator precedence. This is the same way most programming languages and scientific calculators evaluate arithmetic: multiplication and division are performed before addition and subtraction, and parentheses override the default order.

The parser supports the following operators:

SymbolMeaningPrecedence
+AdditionLow
− or -SubtractionLow
×, *MultiplicationMedium
÷, /DivisionMedium
^Exponent (power)High (right-associative)
( )GroupingHighest

Numbers may be integers, decimals, or in scientific notation such as 1.5e3. Unary minus is supported, so -5 + 3 evaluates to -2.

Worked examples

Example 1 — Order of operations

Expression: 3 + 4 × 2

Multiplication first: 4 × 2 = 8. Then addition: 3 + 8 = 11.

Result: 11

Example 2 — Parentheses change the order

Expression: (3 + 4) × 2

Parentheses first: 3 + 4 = 7. Then multiply: 7 × 2 = 14.

Result: 14

Example 3 — Exponent and unary minus

Expression: -2^2 + 10

Exponent first (binds tighter than unary minus in most calculators): 2^2 = 4, then negate: -4, then add: -4 + 10 = 6.

Result: 6

To compute (-2)^2 (which is 4), write the parentheses explicitly.

Common mistakes

  • Assuming left-to-right evaluation. The calculator respects operator precedence, so 2 + 3 × 4 is 14, not 20. Use parentheses if you want left-to-right evaluation: (2 + 3) × 4 = 20.
  • Missing multiplication signs. 2(3+4) is not accepted. Write 2 × (3 + 4).
  • Mixing parentheses. Every opening ( needs a matching closing ). Unbalanced parentheses trigger a clear error message.
  • Confusing exponent associativity. 2^3^2 is evaluated right-to-left as 2^(3^2) = 512, matching standard mathematical convention.

Frequently asked questions

Yes. Multiplication and division are evaluated before addition and subtraction, and parentheses override the default order. This matches standard mathematical convention.

You can use any of the following: +, -, * or × for multiplication, / or ÷ for division, ^ for exponents, and parentheses ( ) for grouping. Decimal numbers and scientific notation (like 1.5e3) are also supported.

Division by zero is undefined in mathematics, so the calculator will display an error message rather than returning Infinity or NaN.

The calculator uses IEEE-754 double-precision floating-point arithmetic, accurate to about 15 significant decimal digits. Displayed results are rounded for readability — the underlying calculation always uses full precision.

No. All calculations run locally in your browser. Your expression is never transmitted to a server.