Infix to Postfix and Prefix Converter
Easily convert infix expressions to postfix and prefix formats with our interactive tool. Learn and master expression conversion with step-by-step visualization.
Postfix Expression: ABC*DEF^/G*-H*+
Step-by-Step Conversion
| Character | Stack (Operator) | Output (Postfix) | Explanation |
|---|---|---|---|
| ( | ( | '(' pushed onto the stack. | |
| A | ( | A | Operand 'A' added to the output. |
| + | ( + | A | Operator '+' pushed onto the stack. |
| ( | ( + ( | A | '(' pushed onto the stack. |
| B | ( + ( | AB | Operand 'B' added to the output. |
| * | ( + ( * | AB | Operator '*' pushed onto the stack. |
| C | ( + ( * | ABC | Operand 'C' added to the output. |
| - | ( + ( - | ABC* | Operator '-' pushed onto the stack. |
| ( | ( + ( - ( | ABC* | '(' pushed onto the stack. |
| D | ( + ( - ( | ABC*D | Operand 'D' added to the output. |
| / | ( + ( - ( / | ABC*D | Operator '/' pushed onto the stack. |
| E | ( + ( - ( / | ABC*DE | Operand 'E' added to the output. |
| ^ | ( + ( - ( / ^ | ABC*DE | Operator '^' pushed onto the stack. |
| F | ( + ( - ( / ^ | ABC*DEF | Operand 'F' added to the output. |
| ) | ( + ( - | ABC*DEF^/ | Pop operators from stack until '(' is found. |
| * | ( + ( - * | ABC*DEF^/ | Operator '*' pushed onto the stack. |
| G | ( + ( - * | ABC*DEF^/G | Operand 'G' added to the output. |
| ) | ( + | ABC*DEF^/G*- | Pop operators from stack until '(' is found. |
| * | ( + * | ABC*DEF^/G*- | Operator '*' pushed onto the stack. |
| H | ( + * | ABC*DEF^/G*-H | Operand 'H' added to the output. |
| ) | ABC*DEF^/G*-H*+ | Pop operators from stack until '(' is found. |