Order of Operations Calculator

Type any arithmetic expression and we will evaluate it one operation at a time, rewriting the whole expression at every step. If you typed one of those viral problems like 8/2(2+2), you will get both defensible answers, the full working for each, and an explanation of why the notation started the fight.

Try one:
Put this calculator on your website for free

Copy one snippet and give your visitors a working Order of Operations Calculator.

How this order of operations calculator works

You type an expression, and we evaluate it the way a patient teacher would at a whiteboard: exactly one operation per step, rewriting the whole expression after each one, so you can watch 8 / 2 * (2 + 2) become 8 / 2 * 4, then 4 * 4, then 16. Innermost parentheses go first, then exponents, then multiplication and division as one left-to-right pass, then addition and subtraction the same way. Every step names the rule it is using, and the steps come from the same code that produces the answer, so they can never disagree with it.

The input is deliberately forgiving. Implied multiplication like 2(3+4) works, and so do the characters people actually paste out of social media posts: the real times and divide signs, superscript exponents, a stray equals sign on the end. If an expression divides by zero partway through, the steps run right up to the exact operation where it dies and say so, because "undefined" is more useful when you can see precisely where the math stopped being math. And if your expression contains the one famous pattern that genuinely has two defensible answers, this page does something almost no calculator will: it refuses to pick a winner, and shows you both complete workings instead. More on that below, because it is the whole reason this page exists.

What PEMDAS actually says: four ranks, not six

PEMDAS has six letters, and that is the root of half the arguments on the internet. The rules it abbreviates have only four ranks:

1. Parentheses, innermost first
2. Exponents, top down in a tower
3. Multiplication and Division, one rank, left to right
4. Addition and Subtraction, one rank, left to right

The M does not outrank the D, and the A does not outrank the S. They are ties, and ties are broken by reading left to right. So 8 / 2 * 4 is 16, not 1: divide first because the division sits further left, not because either operation is senior. And 12 - 4 + 2 is 10, not 6: the subtraction goes first for the same reason. Doing the addition first because A comes before S in the mnemonic is probably the single most common order of operations mistake, and it comes from the mnemonic, not the math.

Here is a quick proof that the letter order means nothing. The UK teaches BODMAS: same rules, and the D now sits in front of the M. If the letters were a priority list, British students would divide before multiplying while American students multiplied before dividing, and the two countries would disagree on basic arithmetic. They do not, because both mnemonics compress the same four ranks.

Worked example

Take 3 + 4 * 2. Multiplication outranks addition, so the 4 * 2 goes first even though the 3 + is sitting further left. This is the calculator's actual output for that input, step for step:

= 11

  1. Multiplication and division. Multiplication and division are a single rank, worked left to right. They do come before addition and subtraction. Leftmost first: 4 * 2 = 8.
    Now: 3 + 8
  2. Addition and subtraction. Addition and subtraction are the last rank, also a single rank worked left to right. Leftmost first: 3 + 8 = 11.
    Now: 11

Now the tie-break case, 12 - 4 + 2. Both operations sit on the same rank, so left to right decides: 12 - 4 = 8 first, then 8 + 2 = 10. The answer is 10. If you got 6, you did the addition first, which is exactly the mnemonic-reading trap from the section above.

The famous fights: 8/2(2+2) and 6/2(1+2)

Every year or two, one of these expressions racks up a hundred million views, thousands of people insult each other in the replies, and both sides are certain the other failed third grade. Here is the truth neither side wants: the expression is ambiguous by notation, and both camps are following a real rule.

The fight hinges on one question: how tightly does multiplication written without a sign bind? In 8/2(2+2), the 2 sits directly against the parenthesis. Read strictly left to right, the way almost all modern calculators and programming languages do, it is (8/2)*(2+2) = 4 * 4 = 16. But there is an older convention, common in early twentieth century textbooks and still alive in physics journal style, where a number written directly against a parenthesis or a variable is one glued unit: 2(2+2) means the quantity 8, and the expression is 8/(2*(2+2)) = 8/8 = 1. Under that convention, 1/2x means one over two x, which is how most physicists would honestly read it on a chalkboard. The same split gives 6/2(1+2) the answers 9 and 1.

If you think one side is simply right, consider that Texas Instruments could not agree with itself. TI's own support documentation records that the TI-80, TI-81, TI-82, and TI-85 gave implied multiplication higher priority, so 6/2(1+2) returned 1, while the TI-83 and every TI model since treats implied and explicit multiplication identically and returns 9. Same company, same expression, different answers, on purpose, in shipping firmware. When the people who build calculators for a living changed conventions mid-product-line, "there is obviously one right answer" stops being a serious position.

This page detects the pattern, a division followed by an implied multiplication, and shows both complete workings side by side with a verdict: ambiguous by notation. Note what does not trigger it: write the sign yourself, 8/2*(2+2), and there is no ambiguity at all. An explicit sign has no special glue, left to right applies, and the answer is 16 with nothing to argue about. That asymmetry is the entire lesson. The fight was never about arithmetic; it lives in one missing multiplication sign.

These problems are engineered to start fights

Viral math bait is not badly written by accident. Whoever composes 8/2(2+2) makes two specific choices: they omit the multiplication sign, and they write the division inline with a slash instead of a fraction bar. Each choice is what arms the trap. Put the sign in and the ambiguity vanishes. Write it with a fraction bar and the ambiguity never exists in the first place, because a fraction bar shows you exactly where the denominator ends: 8 over 2, times (2+2), is visibly a different expression from 8 over the whole product 2(2+2). Nobody has ever had a comment-section fight about a fraction bar.

So the fix costs one pair of parentheses. If you mean 16, write (8/2)(2+2) or just add the sign: 8/2*(2+2). If you mean 1, write 8/(2(2+2)). Working mathematicians handle this by never writing the ambiguous form at all: in print, division gets a fraction bar, and inline, anything of the shape a/bc gets parentheses. The expression is not a test of your arithmetic. It is a test of whether you can recognize a badly posed question, and the strongest answer is naming the ambiguity instead of picking a camp.

Exponent towers and the minus sign

Two more conventions catch people, and this calculator names both in its steps when they come up. First, exponent towers: 2^3^2 is 512, not 64, because exponentiation is right-associative. The tower collapses from the top down, so 2^3^2 means 2^(3^2) = 2^9 = 512. If you wanted (2^3)^2 = 64, the parentheses say so. Second, the minus sign: -3^2 is -9, because the exponent binds tighter than the unary minus. The expression means -(3^2); squaring negative three is written (-3)^2 and equals 9. One honest warning for spreadsheet users: Excel breaks with written-math convention here and evaluates =-3^2 as 9, so a formula and a textbook can disagree while both are behaving as documented.

How to win the thread politely

Someone in your feed is very confident the answer is 1. Someone else is very confident it is 16, and both of them have tagged you. Here is the move that actually ends it: do not pick a side, because the sides are not the point. Say that both answers follow a real convention, that calculators have shipped with each behavior, and that the expression is ambiguous because the multiplication sign was deliberately left out. Then link this page with the expression filled in, so both people can watch their own reading worked out step by step next to the other one. You are not the person who got it right; you are the person who explained why everyone else was fighting. That is a better position, it happens to be the mathematically correct one, and the citation button on this page exists for exactly that moment.

Frequently asked questions

What is the answer to 8/2(2+2)?

16 or 1, depending on a notation convention, and that is the honest answer. Reading it strictly left to right gives (8/2)*(2+2) = 16, which is what most modern calculators do. Treating 2(2+2) as one glued unit gives 8/(2*(2+2)) = 1, which older textbooks and some physics journals would print. The expression went viral precisely because it is written to trigger both readings at once.

What is 6/2(1+2)?

Same shape, same story: 9 by the strict left to right convention, 1 by the juxtaposition convention. It is not a puzzle you can out-clever; it is a badly written expression. Texas Instruments' own calculators split on it: a TI-82 returns 1 and a TI-83 returns 9, and TI documented the change themselves.

Do you multiply before dividing?

No. Multiplication and division are a single rank, worked left to right, so 8/2*4 is (8/2)*4 = 16, not 8/(2*4) = 1. The M coming before the D in PEMDAS is mnemonic order, not priority. BODMAS, the same rules under a different name, puts the D first, which would be a contradiction if the letter order carried any meaning.

Is PEMDAS wrong?

PEMDAS is right but compressed. Six letters describe four ranks: parentheses, then exponents, then multiplication and division together, then addition and subtraction together. Most viral arguments come from reading the six letters as six separate ranks, or from the implied multiplication problem that PEMDAS never addresses at all.

What is -3^2?

-9 by the standard written-math convention: the exponent binds tighter than the minus sign, so -3^2 means -(3^2). If you want the square of negative three, write (-3)^2, which is 9. Spreadsheets are a famous exception: Excel evaluates =-3^2 as 9, which surprises nearly everyone at least once.

What is 2^3^2?

512. Exponent towers are right-associative, meaning 2^3^2 reads as 2^(3^2) = 2^9 = 512, not (2^3)^2 = 64. Work from the top of the tower down. If you mean the other one, write the parentheses and nobody has to guess.

Why do two calculators give different answers to the same expression?

Because their firmware disagrees about multiplication written without a sign. Texas Instruments' TI-80 through TI-85 gave implied multiplication higher priority, so 6/2(1+2) returned 1; the TI-83 family and everything since treats it like an ordinary multiplication and returns 9. When the manufacturer changed its mind mid-product-line, you are allowed to stop arguing with strangers about it.

What does PEMDAS stand for?

Parentheses, Exponents, Multiplication, Division, Addition, Subtraction; commonly memorized as Please Excuse My Dear Aunt Sally. The UK teaches BODMAS (Brackets, Orders, Division, Multiplication, Addition, Subtraction) and Canada often uses BEDMAS. All three describe the same four ranks; only the mnemonic changes.

Related calculators