Order of Operations Calculator

Enter any math expression and get a full step-by-step solution following PEMDAS / BODMAS rules.

P — Parentheses E — Exponents MD — Mult/Div AS — Add/Sub

Supports: + − * / ^ ** ( ) [ ] — use ^ or ** for exponents

Examples:

What Is Order of Operations?

The order of operations is the agreed-upon set of rules that dictates which part of a mathematical expression is calculated first. Without these rules, the expression 3 + 5 × 2 could equal either 13 or 16 depending on which operation you perform first. The standard convention, remembered by the acronym PEMDAS in the US and BODMAS in the UK, resolves all ambiguity by establishing a strict hierarchy of operations.

This order of operations is not arbitrary — it evolved over centuries of mathematical convention and is now universal in algebra, computer science, engineering, and everyday arithmetic. Every calculator, spreadsheet, and programming language follows these rules.

The PEMDAS Rules — A Detailed Breakdown

P

Parentheses / Brackets

Always evaluate expressions inside parentheses (), square brackets [], or curly braces {} first. For nested groups, work from the innermost outward. Example: (2 + 3) = 5 before multiplying.

E

Exponents / Orders / Powers

After parentheses, evaluate exponents (powers and roots). Example: 3² = 9. Note that exponents associate right to left: 2^3^2 = 2^(3^2) = 2^9 = 512.

MD

Multiplication & Division (left to right)

Multiplication and division share equal precedence and are worked strictly left to right. Example: 12 ÷ 4 × 3 = 3 × 3 = 9 (not 12 ÷ 12 = 1). This is the most common source of errors.

AS

Addition & Subtraction (left to right)

Finally, addition and subtraction are performed left to right at the same precedence level. Example: 10 − 3 + 2 = 7 + 2 = 9 (not 10 − 5 = 5).

Common Mistakes with Order of Operations

Even experienced students make these errors:

  • Left-to-right for × and ÷: Treating multiplication as always higher than division leads to wrong answers. Both are equal priority; work left to right.
  • Unary minus with exponents: -3² means -(3²) = -9, not (-3)² = 9. Use parentheses to avoid confusion.
  • Implicit multiplication: Some texts write 2(3+1) meaning 2×4=8. Always make the × explicit in digital calculators.
  • Forgetting nested brackets: Work strictly from innermost to outermost parentheses.

PEMDAS Examples

Expression Working Answer
3 + 5 × 2Multiply first: 3 + 1013
(2 + 3)² × 4Brackets: 5² × 4 → Exponent: 25 × 4100
12 / 4 + 2 × 5 − 13 + 10 − 1 = 13 − 112
(4+(6−2)) × 3²Inner: (4+4) × 9 = 8 × 972

Why Order of Operations Matters

Every programming language, spreadsheet formula, and scientific calculator uses this same hierarchy. Without a universal convention, two engineers using the same formula could compute different answers — a potentially catastrophic outcome in engineering or finance. PEMDAS/BODMAS provides the universal grammar of arithmetic.

In computer science, understanding operator precedence is essential for writing correct code. Languages like Python, JavaScript, C, and Java all implement PEMDAS precedence in their arithmetic operators. Misunderstanding precedence is one of the most common sources of subtle programming bugs.

Frequently Asked Questions

PEMDAS stands for Parentheses, Exponents, Multiplication, Division, Addition, Subtraction. It is the US standard mnemonic for the order of operations. A common memory aid is "Please Excuse My Dear Aunt Sally." Following this order ensures every arithmetic expression has one unambiguous answer.
PEMDAS and BODMAS describe identical rules using different words. BODMAS (Brackets, Orders, Division, Multiplication, Addition, Subtraction) is used in the UK, Australia, and many Commonwealth countries. The key distinction is cosmetic: "Brackets" = "Parentheses," and "Orders" = "Exponents." Both produce exactly the same computation order.
Multiplication and division are mathematically inverse operations with no inherent ranking between them. The convention to evaluate them left to right at equal priority is necessary to prevent ambiguity. For example, 24 ÷ 6 × 2: evaluated left to right gives 4 × 2 = 8. If you gave multiplication higher priority, you'd get 24 ÷ 12 = 2 — a different answer.
Work from the innermost set of parentheses outward. In 5 × (2 + (8 − 3)): first evaluate (8 − 3) = 5, giving 5 × (2 + 5); then (2 + 5) = 7, giving 5 × 7 = 35. Always resolve the deepest nesting level before moving outward.
Without parentheses, apply the remaining hierarchy: exponents first, then multiplication and division left to right, then addition and subtraction left to right. For example, 2 + 3² × 4: exponent first (9), then multiply (36), then add: 2 + 36 = 38.
Yes. Exponents have higher precedence than multiplication and division. So 3 × 2³ = 3 × 8 = 24, not (3 × 2)³ = 216. If you want the base to include the coefficient, use parentheses: (3 × 2)³.
GEMDAS stands for Grouping, Exponents, Multiplication, Division, Addition, Subtraction. The word "Grouping" replaces "Parentheses/Brackets" to include all types of grouping symbols: parentheses (), brackets [], braces {}, absolute value bars | |, and fraction bars. The computational rules are identical to PEMDAS and BODMAS.

Related Calculators