Open In App

Online Postfix to Prefix Converter

Our Postfix to Prefix converter tool helps you convert an expression written in postfix notation (Reverse Polish Notation) to its equivalent prefix notation (Polish Notation). Convert your postfix expressions to prefix notation easily with this free online tool.



How to Use Postfix to Prefix Converter?

Step 1: Enter your postfix expression in the text box below.

Step 2: Click the “Convert” button.



Step 3: The equivalent prefix expression will be displayed below.

What are Postfix and Prefix Notation?

Infix notation is the standard way we write mathematical expressions, with operators placed between operands (e.g., 2 + 3). Postfix notation puts operators after operands (e.g., 2 3 +), while prefix notation places operators before operands (e.g., + 2 3).

Example:

Postfix: 2 3 +
Prefix: + 2 3

How to convert Postfix to Prefix?

Illustration:

Input String(Postfix) Remaining Postfix Expression Stack (Prefix)
AB+c* B+c* A
AB+c* +c* AB
AB+c* c* +AB
AB+c* * +ABc
AB+c* *+ABc

Prefix Notation is in the stack that is *+ABc.

Important Notes:

  • This converter supports basic arithmetic operators like addition (+), subtraction (-), multiplication (*), and division (/).
  • The operands should be separated by spaces.
  • Make sure the expression is well-formed and follows postfix notation rules.
Article Tags :