Complete the square calculator
x² + 6x + 5 becomes (x + 3)² − 4, with its vertex at (−3, −4): enter the three coefficients and get the vertex form, the turning point and the axis of symmetry of the parabola. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- A
- 1
- B
- 6
- C
- 5
- H
- -3
- K
- -4
- Vertex
- -3, -4
- Vertex form
- (x + 3)^2 - 4
This complete-the-square calculator rewrites a quadratic polynomial ax squared plus bx plus c into vertex form a times (x minus h) squared plus k, and returns the vertex coordinates h and k. Completing the square is the classic algebraic bridge between standard form and the geometry of a parabola: the axis of symmetry sits at x equals h, and the minimum or maximum value is k, depending on the sign of a. The identities used here are fully deterministic: h equals negative b over two a, and k equals c minus b squared over four a. Small checks you may already know include a equals one, b equals six, c equals five yielding h equals negative three and k equals negative four, and a equals two, b equals negative eight, c equals three yielding h equals two and k equals negative five. The engine uses only finite arithmetic with no network calls, no sampling, and no date-dependent shortcuts.
Where vertex form fits in study, graphing, and software
Students meet completing the square when a textbook moves from expanded quadratics to graphing, when a contest problem asks for the minimum of a quadratic without calculus, or when they convert between standard form and vertex form before applying transformations. Teachers can pre-generate answer keys for modest coefficients without trusting opaque calculator apps that silently switch notation or drop signs on h.
Developers call the same contract from scripts to seed deterministic test vectors for parabola renderers, to normalize user-entered polynomials before optimization demos, or to satisfy programming-challenge statements that demand h and k rather than a hand-waved sketch. Contest practice often needs a fast, offline source of vertex coordinates so solutions can be checked without graphing calculators under time pressure.
Product and education tools use the rewrite when a learner types ax squared plus bx plus c and the UI must show the vertex and a clean a(x minus h) squared plus k expression.
What you can do with it
Homework and vertex checks
Rewrite textbook quadratics into a(x − h)² + k and verify h and k before graphing or finding min/max.
Graphing and tutoring software
Normalize user-entered ax² + bx + c into vertex form for plotters, step helpers, and interactive lessons.
FAQ
What does the complete-the-square calculator cost?
It is free in your browser on this page.
How are h and k defined?
For ax² + bx + c with a ≠ 0, h = −b/(2a) and k = c − b²/(4a). The vertex form is a(x − h)² + k.
Does this tool find the roots of the quadratic?
No. It only rewrites the polynomial into vertex form and returns h and k. Use a root solver if you need the zeros.
Why are results rounded to a precision?
Default precision is 10 decimal places; you can set precision from 0 to 15.
Is k the minimum or the maximum of the parabola?
It depends on the sign of a. When a is positive the parabola opens upward and k is its minimum; when a is negative it opens downward and k is its maximum, reached at x equal to h.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/algebra/complete-the-square \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"a":1,"b":6,"c":5}'const res = await fetch("https://api.kit.forhosting.com/algebra/complete-the-square", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"a": 1,
"b": 6,
"c": 5
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/algebra/complete-the-square",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"a": 1,
"b": 6,
"c": 5
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/algebra/complete-the-square", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"a":1,"b":6,"c":5}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"a":1,"b":6,"c":5}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/algebra/complete-the-square", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"a": 1,
"b": 6,
"c": 5
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "algebra.complete_the_square",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_abs_coeff | 1000000000000000 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
What completing the square means and what the response contains
Completing the square rewrites ax squared plus bx plus c so the x terms sit inside a perfect square, producing a times (x minus h) squared plus k. That vertex form makes the turning point of the parabola obvious: the vertex is the point (h, k), the axis of symmetry is the vertical line x equals h, and the graph opens upward when a is positive or downward when a is negative. Algebraically, divide the linear contribution by twice the leading coefficient to locate h, then evaluate the constant adjustment k equals c minus b squared over four a, which is exactly the function value at x equals h. This calculator returns the normalized coefficients a, b, and c, the values h and k rounded to the requested precision, a two-element vertex array, a human-readable vertex_form string such as (x + 3)^2 - 4, a standard_form echo of the input polynomial, the method tag complete_the_square, the precision used, and a short formula reminder. There is no approximate symbolic CAS path and no random sampling of roots: the engine either builds exact floating-point h and k inside the supported coefficient range or rejects the input with invalid_input. Rejected cases include missing a, b, or c, non-finite values, magnitudes above the documented ceiling, and any a that is zero or numerically zero, because a linear or constant expression is not a quadratic and has no unique vertex form of this kind.
How a, b, and c are read and how h and k stay reproducible
Optional leading plus signs and scientific notation on coefficient strings are allowed when they parse as finite decimals; embedded spaces, hex prefixes, and non-numeric tokens are rejected with a clear message so a bad cell does not become a wrong vertex. Zero for b or c is valid and simply yields a simpler vertex or a pure vertical shift. The preferred fields are a for the leading coefficient, b for the linear coefficient, and c for the constant term, but aliases A and leading for a, B and linear for b, and C and constant for c are accepted so spreadsheets, query strings, and typed forms can reuse the same contract. The leading coefficient a must be non-zero: if absolute a is at or below a tiny epsilon, the request fails with invalid_input because the expression is not quadratic. An optional precision field, with aliases decimals and dp, chooses how many decimal places to expose for a, b, c, h, and k, defaulting to ten and capped at fifteen so JSON goldens stay stable. Pair the free browser run on this page with the priced API when you need the identical mathematical result inside an automated pipeline without re-implementing the vertex formulas yourself.
Where vertex form fits in study, graphing, and software
On this page the work runs entirely in your browser; through the API each successful lookup costs $0.002, failed validation is not charged, and nothing is stored after the response returns. That split — free interactive exploration and a priced, identical API — matches the rest of the KIT tier-A catalog and lets you move from a classroom demo to an automated pipeline without changing the mathematical result. Pair it with quadratic-root or linear-system tools when you need related algebra steps, and with other math endpoints when you are building a small lab of free, deterministic algebra helpers.
Integration use cases
Deterministic test fixtures
Generate reproducible h, k, and vertex_form strings for unit tests, property checks, and CI assertions.
Technical questions
What happens if a is zero?
The input is rejected with invalid_input. a = 0 makes the expression linear or constant, not a quadratic with a unique vertex form of this kind.