Order of Operations Calculator
Enter any math expression and get a full step-by-step solution following PEMDAS / BODMAS rules.
Supports: + − * / ^ ** ( ) [ ] — use ^ or ** for exponents
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
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.
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.
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.
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 × 2 | Multiply first: 3 + 10 | 13 |
| (2 + 3)² × 4 | Brackets: 5² × 4 → Exponent: 25 × 4 | 100 |
| 12 / 4 + 2 × 5 − 1 | 3 + 10 − 1 = 13 − 1 | 12 |
| (4+(6−2)) × 3² | Inner: (4+4) × 9 = 8 × 9 | 72 |
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.