CompoundPage

Order of Operations Calculator

Type an expression into the order of operations calculator and see it reduced one operation at a time: parentheses, exponents, multiplication and division, then addition and subtraction. The expression is rewritten after every step.

Use + - * / ^ (or × ÷ and x) and any brackets. 2(3 + 4) is read as multiplication.

Answer11

Your expression
8 + 2 × (3 + 1)^2 ÷ 4 - 5
Step 1: brackets (add) Inside the innermost brackets: 3 + 1 = 4. Brackets come first, and inside them the same order applies.
8 + 2 × 4^2 ÷ 4 - 5
Step 2: exponent 4^2 = 16. Exponents come before multiplication and division.
8 + 2 × 16 ÷ 4 - 5
Step 3: multiply 2 × 16 = 32. Multiplication and division are one level, done left to right.
8 + 32 ÷ 4 - 5
Step 4: divide 32 ÷ 4 = 8. Multiplication and division are one level, done left to right.
8 + 8 - 5
Step 5: add 8 + 8 = 16. Addition and subtraction are one level, done left to right.
16 - 5
Step 6: subtract 16 - 5 = 11. Addition and subtraction are one level, done left to right.
11
Answer 6 operations, in order.
11
Straight left to right, ignoring precedence What a basic four-function calculator gives if you key the expression in as written: each operation is applied to the running total as it arrives. Precedence exists so that 2 + 3 × 4 means 2 + 12, the way it is universally written.
395
The four levels, and how many operations each took here
LevelCoversIn this expression
1. Brackets( ), [ ], { }, innermost first1 pair
2. Exponents^, right to left1
3. Multiply and divide×, ÷ and implicit, left to right2
4. Add and subtract+, -, left to right3
  • Order: brackets (innermost first), exponents (right to left), multiplication and division (left to right), addition and subtraction (left to right). PEMDAS, BODMAS and BIDMAS all name this same order.

How the Order of Operations Calculator works

The order of operations is the agreement that makes a line of arithmetic mean one thing. Without it, 2 + 3 × 4 could be 20 or 14. The convention says 14: multiplication is done before addition. The full order has four levels:

1. BRACKETS (parentheses, square brackets and braces), innermost first. 2. EXPONENTS (powers and roots). 3. MULTIPLICATION AND DIVISION, together, from left to right. 4. ADDITION AND SUBTRACTION, together, from left to right.

PEMDAS (Parentheses, Exponents, Multiplication, Division, Addition, Subtraction) is the American mnemonic; BODMAS and BIDMAS, used in Britain and elsewhere, say Brackets, Orders or Indices, Division, Multiplication, Addition, Subtraction. They describe the same rules. The different letter order between them is the clue to the most common mistake.

THE LEFT-TO-RIGHT RULE. Multiplication and division are one level, not two, and so are addition and subtraction. PEMDAS lists M before D only because a word has to put one letter first. So 12 ÷ 3 × 2 is 4 × 2 = 8, working left to right, and not 12 ÷ 6 = 2. Likewise 10 - 3 + 2 is 9, not 5. Students who read the mnemonic letter by letter get these wrong, and the page shows that reading whenever it gives a different answer.

EXPONENTS RUN THE OTHER WAY. A stack of exponents is evaluated from the top down: 2^3^2 means 2^(3^2) = 2^9 = 512, not (2^3)^2 = 64. This is the one place the order goes right to left, and it is because (a^b)^c can always be written as a^(bc), so the tower notation is reserved for the reading that would otherwise need brackets.

A MINUS SIGN BEFORE A POWER. -3^2 is -9, not 9. The exponent applies to the 3 alone, and the minus is applied after, exactly as -x^2 means -(x^2) in algebra. To square negative three, write (-3)^2. Spreadsheets are the notable exception: Excel gives =-3^2 as 9, so a formula copied from a spreadsheet into anything else can change its answer.

IMPLICIT MULTIPLICATION. A number written against a bracket, as in 2(3 + 4), means multiply. This calculator treats it exactly like a written × sign: the same level as × and ÷, worked left to right with them. That is the strict reading of the rules as they are usually taught, and it decides the expression that resurfaces online every year, 6 ÷ 2(1 + 2). Brackets first gives 6 ÷ 2 × 3; left to right gives 3 × 3 = 9. The competing reading treats 2(1 + 2) as a single unit that binds tighter than division, giving 6 ÷ 6 = 1, and it is not unreasonable: in much scientific writing 1/2x means 1/(2x). The expression is ambiguous by design. Anyone writing for a reader should add the brackets that remove the doubt; this calculator shows both readings whenever the difference matters.

EXACT ANSWERS. Every step here is done in fractions, so 1 ÷ 3 + 1 ÷ 6 comes out as exactly 1/2 rather than the 0.49999999999999994 floating-point arithmetic can produce, and 0.1 + 0.2 is exactly 0.3. Where an exact answer cannot exist (2^0.5 is irrational), the arithmetic switches to decimals and says so.

DIVISION BY ZERO has no answer at all, rather than an infinite one: no number multiplied by 0 gives 5, so 5 ÷ 0 is undefined, and the page stops at the step where it happens and shows you which one.

Order of Operations Calculator FAQ

What is the order of operations?

Brackets first (innermost first), then exponents, then multiplication and division together from left to right, then addition and subtraction together from left to right. PEMDAS and BODMAS are mnemonics for this same order.

Does multiplication come before division?

No. They are one level and are done left to right, whichever comes first. 12 ÷ 3 × 2 is 8, not 2. The same goes for addition and subtraction: 10 - 3 + 2 is 9. PEMDAS puts M before D only because the letters have to go in some order.

What is 6 ÷ 2(1 + 2)?

9, under the convention that implicit multiplication is ordinary multiplication: the bracket gives 3, then 6 ÷ 2 × 3 is worked left to right. If 2(1 + 2) is read as one unit that binds tighter than division, it is 1. The expression is ambiguous as written; brackets around the intended product remove the argument.

Is -3^2 equal to 9 or -9?

-9. The exponent applies only to the 3, and the minus sign is applied afterward. Write (-3)^2 if you mean negative three squared, which is 9. Excel is a known exception and returns 9 for =-3^2.

How do you evaluate 2^3^2?

From the top down: 3^2 = 9 first, then 2^9 = 512. Stacked exponents are the one level that runs right to left. Working it bottom-up as (2^3)^2 gives 64, which is a different expression.

Signed numbers

Related calculators

Embed this calculator
<div id="compoundpage-order-of-operations-calculator"></div>
<script src="https://compoundpage.com/embed/order-of-operations-calculator.js" async></script>

The same calculation as JSON