🧮
🧮 Math & statistics

Polish Notation Converter (infix ↔ prefix & postfix / reverse Polish)

Results update as you type.

Your numbers

Understanding the Polish notation converter — concept and principle

This converter turns an arithmetic expression between infix (the usual form), prefix (Polish) and postfix (reverse Polish) notation, evaluates it, and lists the operations in the order a stack would perform them. Use it for computer science courses, compiler and calculator programming, RPN calculators and checking order of operations.

Expression tree in Polish notation(3 + 4) × 5 − 6 ÷ 2−×÷+56234prefix: − × + 3 4 5 ÷ 6 2postfix: 3 4 + 5 × 6 2 ÷ −value = 35 − 3 = 32
Reading the tree root-first gives prefix; children-first gives postfix. No brackets are needed.

How it is calculated

The principle

Infix notation needs precedence rules and brackets to say which operation comes first. Jan Łukasiewicz showed that placing every operator before its operands removes the need for brackets entirely, because each operator always takes the next two complete expressions. Postfix does the same with operators after operands, and it matches how a stack machine works: numbers wait on the stack until an operator uses them. That is why many compilers convert expressions to postfix and why some calculators use RPN.

Worked example

Default input: infix (3 + 4) × 5 − 6 ÷ 2.

  1. Prefix: − × + 3 4 5 ÷ 6 2.
  2. Postfix: 3 4 + 5 × 6 2 ÷ −.
  3. Stack evaluation: 3 + 4 = 7; 7 × 5 = 35; 6 ÷ 2 = 3; 35 − 3 = 32.
  4. Value = 32, using 4 operators.

How to read the result

Read prefix as "apply this operator to the next two things": − (× (+ 3 4) 5) (÷ 6 2). The operation list shows exactly the order in which a computer would evaluate the expression. If the value differs from what you expected, the precedence in your infix expression is probably not what you intended.

Common mistakes

Keep in mind: The converter handles numbers and the operators + − × ÷ ^. Functions, variables and implicit multiplication such as 2(3 + 4) need to be written out explicitly.

Frequently asked questions

Why is it called Polish notation?

It was introduced by the Polish logician Jan Łukasiewicz in the 1920s.

Does postfix ever need brackets?

No. The order of tokens alone fixes the order of operations.

Is prefix the reverse of postfix?

Not in general. Reversing a postfix string also swaps the operand order, so it is not the same as prefix.

Sources: Weisstein, E. W., "Reverse Polish Notation", Wolfram MathWorld

Checked 9 Nov 2026. Weisstein, E. W., “Reverse Polish Notation”, Wolfram MathWorld (operator written after its operands, e.g. 3 4 + 5 × = (3 + 4) × 5; evaluation with a stack; Polish/prefix notation of Jan Łukasiewicz places each operator before its operands). Operator precedence (powers, then multiplication and division, then addition and subtraction) — standard order of operations.

🧮 All math & statistics tools →🌍 Calculators by country →