← All tools

Cubic Equation Solver

Solve a cubic equation ax³ + bx² + cx + d = 0 for its three roots — real or complex — using Cardano's method. Enter the four coefficients and the solver reduces to the depressed cubic t³ + pt + q = 0, classifies the roots from the discriminant, and uses the trigonometric form when all three roots are real (avoiding complex intermediates) and the Cardano cube-root form when one real root and a complex-conjugate pair exist. A residual check evaluates the polynomial at each root so you can confirm the answer. Everything runs locally in your browser.

Method: divide by a, substitute x = t − b/(3a) to reach the depressed cubic t³ + pt + q = 0 with p = (3ac − b²)/(3a²) and q = (2b³ − 9abc + 27a²d)/(27a³). The discriminant Δ = −4p³ − 27q²: Δ > 0 gives three distinct real roots (trigonometric solution), Δ = 0 a multiple real root, Δ < 0 one real root and a complex-conjugate pair (Cardano's cube roots). Roots are x = t − b/(3a). Complex roots are shown as a ± bi. The residual |P(root)| should be ~0. Runs locally.