Starlight Tools

Completing the Square Calculator

Convert a quadratic to vertex form and, if you choose, solve it step by step.

Paste a full expression or use the coefficient fields. The calculator keeps conversion and equation solving clearly separate and uses exact arithmetic in your browser.

Enter a quadratic

Examples: x^2+6x+5, 2x²−8x+5=0, or y=3x²+12x−7. Clear this field to use coefficients.

Text keyboards make fractions such as −3/4 easy to enter. Use zero for a missing term.

What do you want to do?
x² + 6x + 5 = 0Interpreted as a = 1, b = 6, c = 5; solve mode
Try an example

Result

Equivalent identity
x2+6x+5=(x+3)24
Completed-square equation
(x+3)2=4
Exact roots
x = −1 or x = −5
Vertex formy = (x + 3)² − 4
Vertex coordinates(−3, −4)
Axis and minimumAxis x = −3; opens upward; minimum y = −4
Correction term9
Root typeTwo distinct real roots; discriminant Δ = 16
Decimal roots−1, −5
VerificationSubstitution gives 0 for both roots.
Show interactive graph and accessible graph data
Graph of y equals x squared plus 6x plus 5 An upward-opening parabola with vertex at negative 3, negative 4; axis x equals negative 3; roots negative 5 and negative 1; and y-intercept 5.
  • Blue curve: y = x² + 6x + 5
  • Purple dashed line: axis x = −3
Vertex(−3, −4)
Axis of symmetryx = −3
OpeningUpward
Minimumy = −4
Real rootsx = −5 and x = −1
y-intercept(0, 5)

Step-by-step completing the square

Start with the expressionx² + 6x + 5
Complete the squarex² + 6x + 99 + 5Half of 6 is 3, and 3² = 9. Adding and subtracting 9 preserves the expression.
Factor and simplify(x + 3)² − 4x² + 6x + 9 is a perfect-square trinomial.
For the equation, take square roots(x + 3)² = 4, so x + 3 = ±2
State and check the rootsx = −1 or x = −5Substituting either root into x² + 6x + 5 gives 0.

Two completing-the-square tasks

Rewriting an expression and solving an equation use the same perfect-square identity, but they change the algebra in different ways:

x2+px=(x+p2)2(p2)2

Convert an expression

To rewrite ax² + bx + c, factor a from the variable terms: a[x² + (b/a)x] + c. Add and subtract the correction inside the brackets. Because it is inside, the outside correction is multiplied by a.

Solve an equation

To solve ax² + bx + c = 0, divide both sides by a, move the constant, and add the same correction to both sides. Then factor, take both square roots, and isolate x.

Vertex form identity

For any quadratic with a ≠ 0:

ax2+bx+c=a(x+b2a)2+cb24a

This is a(x − h)² + k, where h = −b/(2a) and k = c − b²/(4a). The vertex is (h, k), the axis is x = h, and the vertex is a minimum when a > 0 or a maximum when a < 0.

One non-monic example, both ways

Rewrite the expression

2x² − 8x + 5 = 2(x² − 4x) + 5 = 2[(x − 2)² − 4] + 5 = 2(x − 2)² − 3. The correction inside the brackets is −4, but after multiplication by 2 its effect is −8.

Solve the equation

2x² − 8x + 5 = 0. Divide both sides by 2: x² − 4x = −5/2. Add 4 to both sides: (x − 2)² = 3/2. Therefore x = 2 ± √6/2.

Common error: when converting an expression, do not forget that a correction made inside parentheses is multiplied by the outside coefficient a.

Reviewed method, privacy, and accuracy

Mathematical review: Starlight Tools Mathematics Review Team, experienced in exact-arithmetic calculator implementation and algebra-content quality assurance. Reviewed 31 August 2026. Our editorial process checks formulas against symbolic identities, tests representative edge cases, and accepts corrections through the site contact channel.

Integers, fractions, and finite decimals are converted to reduced fractions and processed with BigInt arithmetic. The displayed algebra is exact; decimal roots are rounded to 10 significant decimal places. Results are verified numerically by substituting each root into the original quadratic.

Technical calculation limits

Each numeric part is limited to 18 digits and normalized integer coefficients must not exceed 1012 in magnitude. Inputs outside that range receive an error. Radical extraction checks square factors up to 100,000 and preserves an exact radical if a very large radicand is not reduced further.

Completing the square FAQs

What does completing the square mean?

It rewrites a quadratic so part of it is a perfect-square binomial. The identity x²+px=(x+p/2)²−(p/2)² is the key step.

What number do I add when completing the square?

After making the x² coefficient 1, take half the x coefficient and square it. For x²+px, add (p/2)² to both sides.

Do I have to divide by a first?

Only when solving an equation. For expression conversion, factor a from the and x terms; for equation solving, divide both sides by a before forming the perfect square.

How does completing the square give vertex form?

ax²+bx+c becomes a(x−h)²+k, where h=−b/(2a) and k=c−b²/(4a).

Can completing the square produce complex roots?

Yes. If the completed square equals a negative number, taking square roots introduces i, the imaginary unit, and gives a complex-conjugate pair.

Does the calculator accept full expressions, fractions, and decimals?

Yes. Paste a quadratic such as 2x² − 8x + 5 = 0, or enter integers, finite decimals, and fractions such as 3/4 in the coefficient fields.

When is completing the square preferable?

Use it when you need the vertex, axis of symmetry, minimum or maximum, or a derivation of the quadratic formula. Factoring is usually faster when integer factors are obvious; the quadratic formula is often shorter when you only need roots.

How do I read the vertex, axis, minimum, or maximum?

In a(x − h)² + k, the vertex is (h, k) and the axis is x = h. If a is positive, k is the minimum value; if a is negative, k is the maximum.

What happens when b is zero or a is negative?

When b = 0, the quadratic is already centered on x = 0, so no correction term is needed. When a is negative, the parabola opens downward and its vertex is a maximum.

Why is half the linear coefficient squared?

Expanding (x + q)² gives x² + 2qx + q². To match a linear coefficient p, choose q = p/2; the needed constant is therefore (p/2)².

How does completing the square derive the quadratic formula?

Starting from ax² + bx + c = 0, divide by a, complete the square, and obtain (x + b/2a)² = (b² − 4ac)/(4a²). Taking both square roots and isolating x gives x = (−b ± √(b² − 4ac))/(2a).

Explore more tools