Order of Operations (PEMDAS) Explained

Apply operations in the right order: brackets, exponents, then multiplication and division, then addition and subtraction. Worked examples and the common traps.

Updated 5 min read By CodingEagles
Free tool Scientific Calculator Powers, roots, trig, logs, memory and history. Open tool

The order of operations is the agreed sequence for evaluating an expression: parentheses first, then exponents, then multiplication and division, then addition and subtraction. The shorthand is PEMDAS. Following it means everyone gets the same answer from the same expression. The scientific calculator applies these rules for you.

Here is the rule, with examples and the traps that catch people out.

What PEMDAS means

PEMDAS lists the operations in priority order:

  1. Parentheses: anything inside brackets is worked out first.
  2. Exponents: powers and roots come next.
  3. Multiplication and Division: these share a rank, done left to right.
  4. Addition and Subtraction: these also share a rank, done left to right.

The same rule is called BODMAS or BIDMAS in some countries, with “orders” or “indices” in place of exponents. The order is identical; only the name differs.

A worked example

Take 3 + 4 × 2² − (5 − 1).

  • Parentheses: (5 − 1) = 4, leaving 3 + 4 × 2² − 4.
  • Exponents: 2² = 4, leaving 3 + 4 × 4 − 4.
  • Multiplication: 4 × 4 = 16, leaving 3 + 16 − 4.
  • Addition and subtraction, left to right: 3 + 16 = 19, then 19 − 4 = 15.

So the answer is 15. Doing the addition before the multiplication would give a different, wrong result, which is exactly what the order is there to prevent.

The equal-rank trap

The most common mistake is thinking multiplication always beats division, or addition always beats subtraction. They do not. Within each pair, you work left to right in the order the operations appear.

For 8 ÷ 2 × 4, the division comes first, so it is (8 ÷ 2) × 4 = 4 × 4 = 16, not 8 ÷ (2 × 4) = 1. The same applies to 10 − 4 + 2, which is (10 − 4) + 2 = 8, not 10 − (4 + 2) = 4.

When notation is ambiguous

Some expressions are written in a way that PEMDAS alone does not settle, such as 8 ÷ 2(2 + 2). Read strictly left to right it is 16, but some conventions treat the implied multiplication as binding more tightly, giving 1. The honest answer is that the notation is ambiguous, and the fix is to add explicit brackets. A calculator follows a fixed rule, so writing 8 ÷ (2 × (2 + 2)) or (8 ÷ 2) × (2 + 2) makes your intent clear.

Where this comes up

The order of operations underlies almost every calculation:

  • Formulas, such as substituting values into the quadratic formula, covered in how to solve a quadratic equation.
  • Spreadsheets and code, which apply the same precedence, so an expression behaves as expected.
  • Mental arithmetic, where knowing the order stops small slips.

Open the scientific calculator to type an expression with brackets and powers and see it evaluated in the right order.

Frequently asked questions

What does PEMDAS stand for?
Parentheses, Exponents, Multiplication and Division, Addition and Subtraction. It is the order in which you carry out operations in an expression. Multiplication and division share a rank, as do addition and subtraction, so within each pair you work left to right.
Is multiplication always done before division?
No. Multiplication and division have equal priority, so you do them left to right as they appear. In 8 ÷ 2 × 4 you divide first because it comes first, giving 4 × 4 = 16, not 8 ÷ 8 = 1. The same left-to-right rule applies to addition and subtraction.
Why does the answer to 8 ÷ 2(2 + 2) cause arguments?
Because the notation is ambiguous. Following PEMDAS strictly, brackets give 8 ÷ 2 × 4 = 16. Some read the implied multiplication as binding tighter, giving 1. Writing the expression with explicit brackets removes the doubt, which is what a calculator relies on.

Ready to try it?

Powers, roots, trig, logs, memory and history. Free, in-browser, and 100% private — your data never leaves your device.

Open the Scientific Calculator