UTILS.
100% in-browser
🟰

Equation Solver (Solve for x)

Solve a linear, quadratic, or higher-degree equation entered as LHS = RHS for x, with step-by-step working and all real and complex roots.

Enter an equation as LHS = RHS in one variable, e.g. x^2 - 5x + 6 = 0.

Enter an equation above to solve for the variable.

About this tool

The Equation Solver takes any single-variable equation written as 'LHS = RHS' and finds every value of the variable that satisfies it. It parses both sides into polynomials, forms f(x) = LHS − RHS, and reduces to standard form aₙxⁿ + … + a₁x + a₀ = 0. A degree-1 equation is solved directly as x = −a₀/a₁. A degree-2 equation uses the quadratic formula x = (−b ± √(b² − 4ac)) / (2a); the sign of the discriminant b² − 4ac decides whether you get two real roots, one repeated root, or a complex-conjugate pair.

For degree 3 and 4 the solver applies the Rational Root Theorem — testing candidates ±p/q where p divides a₀ and q divides aₙ — and peels off each rational root by synthetic division, reducing what remains to a quadratic it can solve in closed form. When no rational roots remain and the degree is still 3 or higher, it switches to the Durand–Kerner (Weierstrass) iteration to locate all complex roots numerically, then rounds values that are extremely close to integers. Exact fractions are kept throughout via gcd reduction, and irrational quadratic roots are shown in simplified radical form.

Everything runs locally in your browser with an eval-free parser, so nothing you type is uploaded. Enter an equation such as '2x + 3 = 7' or 'x^2 - 5x + 6 = 0', optionally name the variable, and read the standard form, the method applied, and the full root list with decimal approximations.

Frequently asked questions

What kinds of equations can it solve?
Single-variable polynomial equations: linear (2x + 3 = 7), quadratic (x^2 - 5x + 6 = 0), and cubic/quartic. Each side may be any polynomial; the tool subtracts them and solves f(x) = 0. Non-polynomial parts (division by the variable, trig, etc.) are rejected as invalid.
How are the roots found?
Degree 1 solves directly; degree 2 uses the quadratic formula with the discriminant b² − 4ac; degree 3–4 use the Rational Root Theorem plus synthetic division and then closed-form quadratic solving; anything remaining is solved numerically with the Durand–Kerner iteration for all complex roots.
Does it show complex and irrational roots?
Yes. A negative discriminant yields a complex-conjugate pair written a ± bi. An irrational quadratic root is simplified to the form (−b ± c√d)/e, and a decimal approximation is shown alongside every exact answer.
Do I have to move everything to one side first?
No. Enter the equation exactly as LHS = RHS — the solver forms LHS − RHS itself, expands and combines like terms, and reports the standard form aₙxⁿ + … + a₀ = 0 before solving.

More tools