⚡
usefultools.dev
f(x)

Math Expression Calculator with Steps

NEW

Math expression calculator that evaluates typed formulas with correct precedence, variables and functions, and shows the RPN and each step.

Runs 100% in your browser — your input is never uploaded or stored on our servers.

Try:
Result =8

Parsed RPN (postfix)

2342^×8÷+

Operands come before their operator. neg = unary minus, f/2 = function with 2 arguments.

Evaluation steps

  1. 4 ^ 2 = 16
  2. 3 × 16 = 48
  3. 48 ÷ 8 = 6
  4. 2 + 6 = 8
Supported syntax
  • Operators + − * / ^, parentheses, unary minus. ^ is right-associative and binds tighter than minus: -2^2 = -4.
  • % after a number is percent (15% = 0.15); between two numbers it is modulo (10 % 3 = 1), as is mod.
  • Functions: sqrt cbrt abs round(x[, digits]) floor ceil exp ln log(x[, base]) log10 log2 sin cos tan asin acos atan sinh cosh tanh min max fact, and n!.
  • Constants pi and e; implicit multiplication like 2pi or 3(x + 1). # starts a comment.
⚡

Quick Examples

Typical inputs and the results this tool produces.

Precedence
2 + 3 * 4
14 (RPN: 2 3 4 × +)
Parentheses
(2 + 3) * 4
20
Unary minus
-2^2
-4
Variables
x = 3, then 2x^2 + 1
19
Percent
200 * 15%
30
📖

Overview

Type a formula the way you would write it on paper and this math expression calculator returns the value as you type. It follows the usual order of operations, supports parentheses, powers, unary minus, percent and modulo, and knows common functions such as sqrt, abs, round, log, ln, sin, cos and tan.

You can also work through a small calculation in several lines: define a variable with r = 2.5 on one line and use it in the next. Each line is evaluated in order and the last one becomes the result.

To help you check or learn how an expression is read, the tool shows its Reverse Polish Notation (postfix) form and every intermediate step. Errors point to the exact line and column. Nothing is uploaded: parsing and evaluation run in your browser.

Why use this tool?

  • See how precedence changes the answer
  • Reuse values with simple variables
  • Error messages show line and column
  • RPN output for learning or debugging parsers
  • No eval, no sign-up, runs locally
⭐

Features

🧮

Correct precedence

Powers before multiplication before addition, with right-associative ^ so 2^3^2 = 512.

🔤

Variables

Write name = expression on a line and use the name in the lines below it.

🔁

RPN view

The parsed expression is shown in postfix order, with neg for unary minus.

🪜

Step-by-step

Every operation is listed in the order it is evaluated, such as 3 × 4 = 12.

📍

Precise errors

Missing parentheses, unknown names or division by zero are marked with a caret.

📐

Functions

sqrt, cbrt, abs, round, floor, ceil, exp, ln, log, trig in radians or degrees, min, max and n!.

🛠️

How to Use

1

Type an expression

Enter a formula such as (1 + 2) * 3^2 / 4 in the box, or click one of the Try buttons.

2

Add variables if needed

Put each assignment like x = 3 on its own line before the expression that uses it.

3

Read the result

The value of the last line appears instantly; copy it with the Copy button.

4

Check the working

Look at the RPN tokens and evaluation steps, or fix the line flagged in red.

🤔

Frequently Asked Questions