Order of Operations

PEMDAS and BODMAS are the same rule under two names. Here is what they mean, where they are commonly misread, and exactly how this calculator evaluates an expression.

Last updated: August 2026 · Written and verified by Akash Pandey

The rule

Without an agreed order, 2 + 3 × 4 could be 14 or 20. The convention that settles it is taught as PEMDAS in the United States and BODMAS or BIDMAS in Britain and much of the Commonwealth. The acronyms differ; the rule does not.

StepPEMDASBODMASMeaning
1ParenthesesBracketsAnything grouped, innermost first
2ExponentsOrders / IndicesPowers and roots
3Multiplication & DivisionDivision & MultiplicationEqual rank, left to right
4Addition & SubtractionAddition & SubtractionEqual rank, left to right

So 8 ÷ 2 × 4 is 16, not 1 - you take the division first only because it comes first on the page, not because division outranks multiplication. Likewise 10 − 3 + 2 is 9, not 5.

Worked through, step by step

  1. Evaluate 2 + 3 × 4²

    2 + 3 × 4^2

    1. Exponents first: 4² = 16, leaving 2 + 3 × 16.
    2. Multiplication before addition: 3 × 16 = 48, leaving 2 + 48.
    3. Finally the addition.

    = 50

  2. Evaluate (6 + 2) × 3 − 4 ÷ 2

    (6 + 2) × 3 - 4 ÷ 2

    1. Brackets first: 6 + 2 = 8, leaving 8 × 3 − 4 ÷ 2.
    2. Multiplication and division rank equally, so work left to right: 8 × 3 = 24.
    3. Then 4 ÷ 2 = 2, leaving 24 − 2.

    = 22

  3. Evaluate 100 ÷ 5 ÷ 2

    100 ÷ 5 ÷ 2

    1. Both operations are division, so strictly left to right.
    2. 100 ÷ 5 = 20.
    3. 20 ÷ 2 = 10. Reading right to left would give 40, which is wrong.

    = 10

  4. Evaluate 2 × (3 + (4 − 1)²)

    2 × (3 + (4 - 1)^2)

    1. Work the innermost bracket first: 4 − 1 = 3.
    2. Apply its exponent: 3² = 9.
    3. Complete the outer bracket: 3 + 9 = 12.
    4. Then the multiplication outside.

    = 24

The cases the acronyms do not cover

Unary minus binds looser than a power

−5² evaluates to −25, not 25. Exponentiation is applied before the negation, so the expression reads as "the negative of 5 squared". If you want the negative number squared, write (−5)². This is standard across mathematics and across essentially every calculator, but it surprises people constantly.

Stacked exponents group right to left

2^3^2 is 2^(3^2) = 2^9 = 512, not (2^3)^2 = 64. Exponentiation is the one common operator that associates right to left rather than left to right.

Implicit multiplication

This calculator accepts 2π and 3(4+1) without an explicit multiplication sign, treating them as multiplication at the normal multiplication precedence. Note that some handheld calculators give implicit multiplication a higher precedence, so that 6÷2(1+2) yields 1 on those machines and 9 here. There is no universal standard for this case - it is genuinely ambiguous notation, and the honest advice is to add brackets rather than rely on any particular machine's reading.

Functions apply to what follows them

sin(30) + 1 takes the sine of 30 and then adds 1. Because the argument is parenthesised there is no ambiguity - which is exactly why this calculator always inserts the opening bracket when you press a function key.

What this calculator actually does

Expressions are parsed by math.js, a well-established open-source expression parser, wrapped in a thin layer that handles the display symbols. The effective precedence, highest first:

PrecedenceOperatorsAssociativity
1 (highest)Parentheses, function callsInnermost first
2Factorial (n!), postfix percent (%)Left to right
3Exponentiation (^)Right to left
4Unary minus / plusRight to left
5Multiplication, division, moduloLeft to right
6 (lowest)Addition, subtractionLeft to right

Frequently Asked Questions

Is PEMDAS or BODMAS correct?

Both. They are two mnemonics for the same convention. The apparent conflict between "MD" and "DM" does not matter, because multiplication and division rank equally and are worked left to right either way.

What is 8 ÷ 2 × 4?

16. Division and multiplication have equal precedence, so they are evaluated left to right: 8 ÷ 2 = 4, then 4 × 4 = 16.

Why does −5² give −25?

Exponentiation binds more tightly than the unary minus, so the expression means "the negative of 5²". Write (−5)² to square the negative number itself.

What is 6 ÷ 2(1 + 2)?

This calculator gives 9, treating implicit multiplication at normal multiplication precedence. Some handheld calculators give 1 by ranking implicit multiplication higher. The notation is genuinely ambiguous - use brackets to say which you mean.

Does the order of operations apply inside brackets too?

Yes. Within each bracket the same hierarchy applies, and nested brackets are resolved innermost first.