Calculator

Order of Operations: Getting the Same Answer Every Time

Why we need an agreed order

Look at 2 + 3 × 4. If you work from left to right, you get 5 × 4 = 20. If you multiply first, you get 2 + 12 = 14. Both look reasonable, but a written expression must mean one thing only, otherwise two people reading the same recipe, formula or homework question would get different answers. So mathematicians agreed on a fixed order, and under that order the answer is 14.

The rule is not a law of nature. It is a convention, like driving on one side of the road. What matters is that everyone uses the same one, and that you know when a calculator is following it and when it is not.

The standard order, step by step

  1. Brackets (parentheses): work out anything inside brackets first, starting with the innermost pair.
  2. Powers and roots (exponents, orders, indices): 3^2, √16 and so on.
  3. Multiplication and division, which have equal rank, worked from left to right.
  4. Addition and subtraction, which also have equal rank, worked from left to right.

Different countries teach this with different memory words, but they all describe the same order.

Memory wordStands forOften taught in
PEMDASParentheses, Exponents, Multiplication/Division, Addition/SubtractionUnited States
BODMASBrackets, Orders, Division/Multiplication, Addition/SubtractionUnited Kingdom, India, Australia and others
BIDMASBrackets, Indices, Division/Multiplication, Addition/SubtractionUnited Kingdom
BEDMASBrackets, Exponents, Division/Multiplication, Addition/SubtractionCanada, New Zealand

Notice that PEMDAS puts M before D while BODMAS puts D before M. That difference is only in the spelling. Neither word means "always multiply before you divide". Multiplication and division share one step, and so do addition and subtraction.

The left-to-right rule that people forget

Because multiplication and division have equal rank, you take them in the order they appear, reading from left to right. The same goes for addition and subtraction.

A neat way to avoid the subtraction trap is to think of subtraction as adding a negative number. 10 − 4 + 3 is 10 + (−4) + 3, and you can add those three numbers in any order you like: the answer is still 9. In the same way, division is multiplying by a reciprocal: 24 ÷ 4 × 2 is 24 × ¼ × 2, which is 12 in any order.

Brackets inside brackets

When brackets are nested, start with the innermost pair and work outwards. Some books use square brackets for the outer layer to make this easier to read.

Example: 2 × [3 + (4 − 1) × 2]

  1. Innermost bracket: 4 − 1 = 3.
  2. Inside the square bracket: 3 + 3 × 2 = 3 + 6 = 9 (multiplication before addition).
  3. Outside: 2 × 9 = 18.

A fraction bar acts as an invisible bracket around the top and around the bottom. The fraction with 12 + 8 on top and 6 − 2 underneath is 20 ÷ 4 = 5. If you type it on one line as 12 + 8 ÷ 6 − 2, the calculator correctly divides first and gives about 11.33, a completely different number. On one line you must write (12 + 8) ÷ (6 − 2).

Powers come before multiplication: 2 × 3^2 = 2 × 9 = 18, while (2 × 3)^2 = 6^2 = 36. Signs in front of powers are covered in the scientific calculator guide.

The viral puzzle: 8 ÷ 2(2 + 2)

Every few years an expression like 8 ÷ 2(2 + 2) or 6 ÷ 2(1 + 2) spreads online, and people split into two camps. One camp answers 16, the other answers 1. Here is where the split comes from.

Both readings exist in real use, which is exactly why the puzzle never dies. In algebra, nearly everyone reads 1/2x as 1 divided by 2x, which is the "block" reading. Yet a strict rule list says nothing special about missing × signs. The honest answer is that the expression is ambiguous, and a careful writer would never publish it.

The calculators on this site use the block reading, like most scientific calculators, so 8 ÷ 2(2 + 2) gives 1 and 1 ÷ 2π gives about 0.159. If you mean 16, type the × sign: 8 ÷ 2 × (2 + 2) = 16. If you mean 1, add brackets: 8 ÷ (2 × (2 + 2)) = 1. Either way, the extra symbols remove all doubt.

Another puzzle that circulates is 9 − 3 ÷ (1/3) + 1. Brackets first give 1/3. Then division: 3 ÷ (1/3) = 9, because dividing by a third is the same as multiplying by 3. Finally, left to right: 9 − 9 + 1 = 1.

Why a simple calculator can give a different answer

Many small pocket calculators and some phone calculators work by immediate execution. Each time you press an operator key, they finish the calculation so far and show a running total. They do not wait to see the whole expression, so they ignore the order of operations.

Keys pressedImmediate executionFormula calculator
2 + 3 × 4 =(2 + 3) × 4 = 202 + 12 = 14
10 − 2 × 3 =8 × 3 = 2410 − 6 = 4
70 + 80 + 90 ÷ 3 =240 ÷ 3 = 8070 + 80 + 30 = 180

Look at the last row carefully. Someone trying to average three scores might type it that way. The immediate-execution calculator happens to give the intended average, 80, while the formula calculator correctly applies the rules and gives 180. The right way to type an average on any formula calculator is (70 + 80 + 90) ÷ 3 = 80. The averages guide explains this calculation in more depth.

You can usually tell which type you have by typing 2 + 3 × 4 =. If it shows 20, it executes immediately. If it shows 14, it follows the order of operations. The basic calculator on this site shows the whole expression as you type and follows the standard order, so 2 + 3 × 4 gives 14.

Chaining calculations safely

Real problems often have several steps. Suppose you buy 3 notebooks at 4.50 each and 2 pens at 2.25 each. The total is 3 × 4.50 + 2 × 2.25 = 13.50 + 4.50 = 18.00.

When in doubt, add brackets. They never change a correct answer, and they protect you from both kinds of calculator.

Common mistakes

FAQ

Is PEMDAS different from BODMAS?
No. They give the same answer to every expression. Both treat multiplication and division as one level and addition and subtraction as another, worked from left to right.

So what is the real answer to 8 ÷ 2(2 + 2)?
It depends on whether implied multiplication is treated as a block. Strict left to right gives 16; the block reading gives 1. Because the expression is ambiguous, the sensible fix is to rewrite it with an explicit × sign or extra brackets.

Do spreadsheets follow the same rules?
Mostly, but some treat a leading minus sign differently from standard maths, so −3^2 may give 9. Use brackets to be sure.

Why do some calculators show the answer only after I press =?
Formula calculators need the whole expression before they can apply the order of operations. The calculator on this site shows a preview as you type, which updates when you add more terms.

Open the calculator: Calculator →

Related guide