Skip to content
Calcapedia
Math

Completing the Square Calculator

Rewrite ax² + bx + c as a(x − h)² + k and solve the equation by completing the square, with every step shown in plain words.

Level: Grades 9–10

  • Common Core standard HSA.SSE.B.3.bComplete the square in a quadratic expression to reveal the maximum or minimum value of the function it defines.
  • Common Core standard HSA.REI.B.4.aUse the method of completing the square to transform any quadratic equation in x into an equation of the form (x - p)² = q that has the same solutions. Derive the quadratic formula from this form.
  • Common Core standard HSF.IF.C.8.aUse the process of factoring and completing the square in a quadratic function to show zeros, extreme values, and symmetry of the graph, and interpret these in terms of a context.
Printable worksheet

Completing the Square Calculator

Inputs

Can't be 0.

Result

Completed-square form

2(x − 3)² − 8

2(x − 3)² − 8, so the vertex is (3, −8) and the solutions are x = 5 or x = 1.

h (x-coordinate of the vertex)
3
k (y-coordinate of the vertex)
-8
Vertex (h, k)
(3, −8)
Solutions of the equation = 0
x = 5 or x = 1
Type of solutions
Two real roots
Axis of symmetry
x = 3

See the step-by-step solution ↓

Step-by-step solution

  1. Factor a out of the x² and x terms, so the bracket starts with a plain x²

    2×x2+−12×x+10=2(x2+−6×x)+10
  2. Halve the number in front of x inside the bracket. This is the number d that goes inside the square

    d=−122×2=−3
  3. Because (x + d)² = x² + 2dx + d², adding d² and then taking it away again completes the square without changing the value

    d2=(−3)2=9
  4. Multiply the d² you took away by a, and combine it with c. This gives the plain number k

    k=10−2×9=−8
  5. So in completed-square (vertex) form, the expression is

    2(x − 3)² − 8
  6. To solve the equation = 0, get the square on its own: (x − h)² = −k ÷ a

    (x − h)2=82=4
  7. Take the square root of both sides. Remember ±, since a positive or negative number squares to the same value. Then add h

    x=3±4=3±2
  8. The two solutions are

    x = 5 or x = 1

Test yourself

20 quick questions built from this calculator's formula: work out results, predict what happens when an input changes, and work backward from an answer. Every answer comes with the working.

What this calculator does

Turn a quadratic like ax² + bx + c into a form where the answer is easy to read. A quadratic is an expression whose highest power is x². Completing the square rewrites it as a number times a perfect square, plus a leftover number: a(x − h)² + k. This shape is called vertex form. Its graph is a U-shaped curve called a parabola. In vertex form, you can read the curve's turning point (the vertex) straight off as (h, k). You can also solve ax² + bx + c = 0 with just a square root.

Enter the three numbers a, b and c (the coefficients). The calculator first pulls a out of the x² and x terms. Next it halves the number in front of x, then adds and subtracts its square. Last, it tidies up the plain numbers. Each line uses your numbers. Then it uses the finished square to solve the equation. You get two real roots (answers), one repeated root, or a complex pair (answers that use i, the square root of −1).

Where it's used

Why this math matters outside the classroom:

  • Maximum height. Rewriting a ball's height −5t² + 20t + 1 as −5(t − 2)² + 21 shows it peaks at 21 m after 2 seconds.
  • Best price. A seller whose profit is −2p² + 60p dollars rewrites it as −2(p − 15)² + 450, so a $15 price gives the top profit of $450.
  • Circle equations. Completing the square turns x² + 6x + y² − 4y = 12 into (x + 3)² + (y − 2)² = 25, a circle of radius 5 centered at (−3, 2).
  • Fencing a pen. With 40 m of fence, a rectangular pen has area x(20 − x) = −(x − 10)² + 100, so a 10 m square gives the most area, 100 m².
  • Deriving the formula. Algebra students complete the square on ax² + bx + c = 0 to derive the quadratic formula they then use on every quadratic.

Grade level and standards: Grades 9–10; Common Core State Standards for Mathematics HSA.SSE.B.3.b, HSA.REI.B.4.a, HSF.IF.C.8.a. © Copyright 2010. National Governors Association Center for Best Practices and Council of Chief State School Officers. All rights reserved.

How to use it

  1. Write the quadratic with its terms in order: the x² term, the x term, then the plain number (the constant).
  2. Enter a, b and c, including their signs. A missing x term or constant is 0.
  3. Read the completed-square form at the top. Underneath are the vertex, the axis of symmetry (the line that splits the curve in half) and the solutions.
  4. Open the working to follow the method line by line. It's a good way to check homework done by hand.

What the inputs mean

a (coefficient of x²)
The number in front of x². It can't be 0. If it's negative, the bracket is multiplied by a negative number, and the parabola opens downward.
b (coefficient of x)
The number in front of x. Half of it, divided by a, is what ends up inside the bracket.

Formula and method

ax² + bx + c = a[x² + (b/a)x] + c
x² + (b/a)x = (x + d)² − d²,   d = b ÷ 2a
ax² + bx + c = a(x + d)² + (c − a·d²) = a(x − h)² + k
h = −b ÷ 2a,   k = c − b² ÷ 4a
a(x − h)² + k = 0   ⟹   x = h ± √(−k ÷ a)

Here a, b and c are your three numbers, and x is the unknown. d is a helper number, half of b/a. h and k give the vertex, the curve's turning point. The method rests on a rule that's always true: (x + d)² = x² + 2dx + d². Once a is pulled out, the number in front of x inside the bracket is b/a. So pick d as half of b/a. Then x² + (b/a)x matches the first two terms of a perfect square. The only thing missing is d². So you add d² inside the square, and subtract it again to keep the value the same.

Multiply the subtracted d² back out by a, and combine it with c. That gives k. Now set the result to zero and get the square on its own. This shows why the quadratic formula works. The value −k ÷ a is exactly the discriminant, b² − 4ac, divided by 4a². The discriminant is the number that tells you what kind of answers you'll get. It's positive for two real roots, zero for a repeated root and negative for a complex pair.

Worked example

Complete the square for 3x² + 12x + 7 and solve 3x² + 12x + 7 = 0.

  1. Factor 3 out of the first two terms: 3(x² + 4x) + 7.
  2. Half of the number in front of x in the bracket is d = 12 ÷ 6 = 2, and d² = 4.
  3. Add and subtract 4 inside: 3[(x + 2)² − 4] + 7 = 3(x + 2)² − 12 + 7 = 3(x + 2)² − 5.
  4. To solve, get the square on its own: (x + 2)² = 5 ÷ 3 ≈ 1.666667, so x + 2 = ±1.290994.
  5. x = −2 + 1.290994 ≈ −0.709006 or x = −2 − 1.290994 ≈ −3.290994.

Result: 3x² + 12x + 7 = 3(x + 2)² − 5, with vertex (−2, −5) and solutions x ≈ −0.709006 and x ≈ −3.290994.

Understanding the result

The vertex (h, k) is the parabola's lowest point when a is positive, and its highest point when a is negative. The up-and-down line x = h is its axis of symmetry. So k is the smallest or largest value the whole expression can have.

If k and a have opposite signs, the parabola crosses the x-axis twice. If k is 0, it just touches the axis at the vertex. If they share a sign, the parabola never reaches the axis, and the solutions are complex.

Assumptions and limitations

  • The numbers a, b and c are real numbers, and a isn't zero.
  • Values are worked out with standard computer decimals (double precision), and rounded to six decimal places in the text. A plain number that differs from zero only by rounding noise is treated as exactly zero. That way, perfect squares are recognised.
  • Fractions such as 1/6 are shown as decimals, not exact fractions.
  • It handles one unknown (x) only. Completing the square with two unknowns, as for circle equations, isn't included.

Frequently asked questions

Why is it called completing the square?

Picture x² as a square with sides of length x. Picture bx as two rectangles stuck to its sides. Put together, they form a square with one small corner missing. That corner has area (b/2)². Adding it literally completes the square.

How does completing the square relate to the quadratic formula?

The quadratic formula is what you get when you complete the square on the general equation ax² + bx + c = 0 and solve for x. Both always give the same roots.

What do I do when a is not 1?

First pull a out of the x² and x terms, so the bracket starts with a plain x². Complete the square inside the bracket. Then remember to multiply the subtracted square by a when you combine the plain numbers. This is the step most people miss, and the calculator shows it exactly.

When is completing the square better than factoring?

Whenever the roots aren't tidy whole numbers, or when you want the vertex of the parabola. Factoring by spotting the answer only works easily for nice roots. Completing the square works for every quadratic.

How this calculator is checked

Method: Algebraic identity (x + d)² = x² + 2dx + d² applied to ax² + bx + c; h = −b/2a, k = c − b²/4a. The calculation is covered by automated tests with known reference values and edge cases. Last updated 2026-10-18. Found a problem? Tell us.

Embed this calculator

Put this Completing the Square Calculator on your own website or blog for free. Paste this code where you want it to appear: