general-knowledgestackrpninfix
Back to General Knowledge

What is infix, postfix and prefix Expressions

July 4, 2022Updated: August 2, 2025
stackrpninfix

Infix, Postfix, and Prefix notations are three different but equivalent ways of writing expressions.

Postfix, also known as Reverse Polish Notation (RPN), and Prefix, known as Polish Notation, are alternative formats.

  • Infix: Operators are placed between operands. Example: A + B
  • Postfix: Operators come after operands. Example: AB+
  • Prefix: Operators precede operands. Example: +AB

Here are additional examples:

InfixPostfixPrefixNotes
A * B + C / DA B * C D / ++ * A B / C DMultiply A and B, divide C by D, then add the results.
A * (B + C) / DA B C + * D // * A + B C DAdd B and C, multiply by A, then divide by D.
A * (B + C / D)A B C D / + ** A + B / C DDivide C by D, add B, then multiply by A.