Polish Notation Calculator — Prefix Expression Evaluator
Enter a mathematical expression in Polish (prefix) notation — where the operator is written before its operands — and see the result with step-by-step evaluation. No parentheses are required; operator precedence is implicit in the structure.
Evaluated from left to right, operator first
* 3 4
+ 12 5
Final result
How does this calculator work?
Polish (prefix) notation places the operator before its operands: + 3 4 = 7, × + 3 4 2 = 14. No parentheses are needed because the tree structure is unambiguous. Evaluation uses a stack: read right-to-left, push numbers, and when an operator appears pop two operands, compute, and push the result. Supported: +, -, *, /, ^.
Formula
How this is calculated
Polish notation, invented by the logician Jan Łukasiewicz in the 1920s, writes every operator before its operands. Because the operator's arity (how many arguments it takes) is fixed, no parentheses are ever needed to resolve ambiguity. For example, the infix expression (3 + 4) × (2 − 1) becomes × + 3 4 − 2 1 in prefix form.
This calculator evaluates the expression using a stack algorithm reading tokens from right to left. Numbers are pushed onto the stack. When an operator is encountered, two operands are popped (the left operand first, then the right), the operation is performed, and the result is pushed back. After all tokens are processed, the single remaining stack item is the answer.
Supported operators are + (addition), - (subtraction), * (multiplication), / (division), and ^ (exponentiation). Division by zero is detected and rejected. The step display shows each sub-expression evaluated in order, making it easy to trace how nested operators resolve to the final answer.
Frequently asked questions
In Polish (prefix) notation, operators come before operands: + 3 4. In Reverse Polish (postfix) notation, operators come after: 3 4 +. Both eliminate the need for parentheses. RPN is used in many calculators (HP calculators, Forth); prefix notation is common in LISP-family languages.
Write × + 2 3 - 4 1. The × applies to the results of + 2 3 (= 5) and - 4 1 (= 3), giving 5 × 3 = 15. There are no parentheses because the tree structure of operators and operands is unambiguous.
Yes: ^ 2 ^ 3 2 evaluates the inner ^ 3 2 first (= 9), then ^ 2 9 (= 512). The right-to-left scan naturally processes inner expressions before outer ones.
Also known as
TG we-Calculate Editorial Team. (2026). Polish Notation Calculator — Prefix Expression Evaluator [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/polish-notation-calculator
TG we-Calculate Editorial Team. "Polish Notation Calculator — Prefix Expression Evaluator." TG we-Calculate. 2026. https://we-calculate.com/calculator/polish-notation-calculator.
TG we-Calculate Editorial Team, "Polish Notation Calculator — Prefix Expression Evaluator," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/polish-notation-calculator
@misc{wecalculate_polish_notation_calculator, title = {Polish Notation Calculator — Prefix Expression Evaluator}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/polish-notation-calculator}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
