Order of Operations Calculator

Order of Operations Calculator

Growing AI Skill PRO

Enter Calculation

Use + - * / ^ ( ) and numbers. PEMDAS is applied automatically.

Formula

Result=eval(Math expression)following()⏟P→xy⏟E→×÷⏟MD→+−⏟AS\text{Result} = \operatorname{eval}\Big( \text{Math expression} \Big)\quad\text{following}\quad \underbrace{(\,)}_{\text{P}} \;\rightarrow\; \underbrace{x^{y}}_{\text{E}} \;\rightarrow\; \underbrace{\times\;\div}_{\text{MD}} \;\rightarrow\; \underbrace{+\;-}_{\text{AS}}
Usage stats

Advertisement

Results

Result
17
evaluated using PEMDAS
Valid Yes

Report an error on this page

What is the Order of Operations Calculator?

This tool evaluates a math expression using the standard PEMDAS / BODMAS order of operations: Parentheses, Exponents, Multiplication and Division (left to right), then Addition and Subtraction (left to right). Type any arithmetic expression and it returns the correct, unambiguous result.

How to use it

Enter an expression using numbers and the operators + - * / ^ along with parentheses ( ). For example, type 3 + 4 * 2 ^ 2 - (1 + 1). The calculator parses the expression, applies operator precedence, and shows the evaluated value.

The formula explained

$$\text{Result} = \operatorname{eval}\Big( \text{Math expression} \Big)\quad\text{following}\quad \underbrace{(\,)}_{\text{P}} \;\rightarrow\; \underbrace{x^{y}}_{\text{E}} \;\rightarrow\; \underbrace{\times\;\div}_{\text{MD}} \;\rightarrow\; \underbrace{+\;-}_{\text{AS}}$$

PEMDAS defines the precedence each operator carries. Exponentiation (^) binds tightest and is right-associative, so \(2^{3^{2}} = 2^{9} = 512\). Multiplication and division share the next level and are evaluated left to right, so \(8 / 4 \times 2 = 4\), not 1. Addition and subtraction come last, also left to right. Parentheses override everything by forcing their contents to be computed first.

Advertisement
Vertical flowchart of PEMDAS priority levels from parentheses down to addition and subtraction
The four priority levels of PEMDAS, evaluated from top to bottom.

Worked example

Evaluate 3 + 4 * 2 ^ 2 - (1 + 1): first the parentheses give \(2\); the exponent gives \(2 ^ 2 = 4\); multiplication gives \(4 \times 4 = 16\); then left to right addition/subtraction gives

$$3 + 16 - 2 = 17$$

.

Step-by-step simplification of an expression following order of operations
Each step resolves the highest-priority operation until one value remains.

Operator Precedence and Associativity Table

Operators with a higher priority are evaluated first. Operators on the same level are evaluated in the direction shown under associativity.

Priority (1 = highest) PEMDAS letter Operator / symbol Associativity Example and result
1 P Parentheses ( ) Innermost group first 2 × (3 + 4) = 2 × 7 = 14
2 E Exponent ^ Right-to-left 2^3^2 = 2^9 = 512
3 M, D Multiplication * and division / Left-to-right 8 / 4 * 2 = 2 * 2 = 4
4 A, S Addition + and subtraction - Left-to-right 10 - 3 + 2 = 7 + 2 = 9

Unary minus: in standard mathematical convention, exponentiation binds tighter than a leading minus sign, so \(-3^2 = -(3^2) = -9\). To square the negative number, write \((-3)^2 = 9\).

Note: some programming languages and spreadsheets use different rules for unary minus or exponent associativity (Excel, for example, evaluates -3^2 as 9). This table follows the standard mathematical convention.

PEMDAS vs. BODMAS: Key Terms

  • Parentheses / brackets: symbols such as ( ) that group part of an expression so it is evaluated first.
  • Exponent / order / index: the power a number is raised to, as in \(a^n\), meaning \(a\) multiplied by itself \(n\) times.
  • Multiplication: repeated addition, written * or ×.
  • Division: splitting into equal parts, written / or ÷. It is the inverse of multiplication.
  • Addition: combining quantities, written +.
  • Subtraction: finding the difference, written -. It is the inverse of addition.
  • Operator precedence: the ranking that decides which operator is applied first.
  • Associativity: the direction (left-to-right or right-to-left) in which operators of the same precedence are evaluated.
  • Unary negation: a minus sign applied to a single value, as in \(-5\), rather than a subtraction between two values.
  • Expression: a combination of numbers, operators and groupings that can be evaluated to one value.
Step PEMDAS (common in the US) BODMAS (common in the UK and elsewhere)
1 Parentheses Brackets
2 Exponents Orders
3 Multiplication / Division Division / Multiplication
4 Addition / Subtraction Addition / Subtraction

The two conventions give the same results. Multiplication and division have equal priority, and so do addition and subtraction. Each pair is evaluated left to right, so the order of the letters M and D (or D and M) does not matter.

Advertisement

More Worked Examples

Example 1: Left-to-right division and multiplication

Evaluate \(100 / 5 * 2 + 3^2\).

  1. Exponent: \(3^2 = 9\), so the expression becomes \(100 / 5 * 2 + 9\).
  2. Division (leftmost of the equal-priority pair): \(100 / 5 = 20\).
  3. Multiplication: \(20 * 2 = 40\).
  4. Addition: \(40 + 9 = \) 49.

Example 2: Nested parentheses

Evaluate \(2 * (3 + (4 - 1)^2) - 5\).

  1. Innermost parentheses: \(4 - 1 = 3\), giving \(2 * (3 + 3^2) - 5\).
  2. Exponent inside the outer parentheses: \(3^2 = 9\), giving \(2 * (3 + 9) - 5\).
  3. Outer parentheses: \(3 + 9 = 12\), giving \(2 * 12 - 5\).
  4. Multiplication: \(2 * 12 = 24\).
  5. Subtraction: \(24 - 5 = \) 19.

Example 3: A common mistake

Evaluate \(6 / 2 * (1 + 2)\).

  1. Parentheses: \(1 + 2 = 3\), giving \(6 / 2 * 3\).
  2. Division first, because it is the leftmost of the equal-priority pair: \(6 / 2 = 3\).
  3. Multiplication: \(3 * 3 = \) 9.

The wrong answer 1 comes from multiplying \(2 * 3 = 6\) first and then computing \(6 / 6\). Multiplication does not outrank division, so this skips the left-to-right rule. If you mean \(6 / (2(1+2))\), write the extra parentheses explicitly.

Bonus: Negative base

\(-2^2 = -(2^2) = -4\), whereas \((-2)^2 = (-2)(-2) = 4\). The parentheses change which value is squared.

FAQ

Does it handle negative numbers? Yes — a leading minus (e.g. -3 ^ 2) is treated as unary negation applied after the exponent, so \(-3 ^ 2 = -9\).

What about division by zero? The calculator detects division by zero and reports that the expression could not be evaluated.

Is multiplication implied by parentheses? No — write the * explicitly, e.g. 2 * (3 + 1), not 2(3 + 1).

Last updated:

Most popular in Math and Statistics

View all Math and Statistics calculators