Basic Calculator

Evaluate an arithmetic expression with correct operator precedence.

What the Basic Calculator does

A four-function calculator that respects operator precedence. Typing an expression in full and letting the parser apply the standard order of operations avoids the mistakes that creep in when intermediate results are entered by hand.

Formula

  • Brackets → Exponents → Multiplication and division → Addition and subtraction
  • Exponentiation is right-associative: 2^3^2 = 2^9
  • Unary minus binds looser than exponentiation: −2^2 = −4

Inputs explained

InputUnitRequiredNotes
ExpressiontextYesUse + − × ÷ ^ and brackets. Multiplication and division bind tighter than addition.
Decimal placesnumberOptionalAccepts 0 or more, up to 12.

How to use it

  1. Enter Expression.
  2. Optionally add Decimal places.
  3. Select Calculate.

Worked example

Evaluating 12 + 5 × 3.

Expression
12 + 5 * 3

Multiplication comes first, so 5 × 3 = 15, then 12 + 15 = 27. Entering it left to right would wrongly give 51.

Frequently asked questions

Why is 12 + 5 × 3 equal to 27 and not 51?

Because multiplication is evaluated before addition. To force the other order, write (12 + 5) × 3.

What does 2^3^2 evaluate to?

512. Exponentiation is right-associative, so it reads as 2^(3^2) = 2^9, not (2^3)^2 = 64.

Related calculators