Circle formula
Both circle equations from a center and a radius: center (3, −2) and radius 5 give (x − 3)² + (y + 2)² = 25 and x² + y² − 6x + 4y − 12 = 0. Ready for worksheets, answer keys and graphics. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Cx
- 3
- Cy
- -2
- Resistance (Ω)
- 5
- Radius
- 5
- Standard form
- (x - 3)^2 + (y + 2)^2 = 25
- General form
- x^2 + y^2 - 6x + 4y - 12 = 0
standard and general equation from center and radius
From a center and a radius to an equation
A circle is the set of points whose distance to a fixed center equals the radius, and the equation is just the Pythagorean theorem applied to that idea: (x − h)² + (y − k)² = r², where (h, k) is the center. The circle formula is returned as a ready-to-read string, so the result can go straight into a worksheet, a report or a rendered page without any extra formatting on your side.
The center coordinates are echoed back alongside the radius, so the answer is self-contained: everything a reader needs to check the equation against the original definition is present in one object. Signs are handled for you, including the cases that trip people up, like a negative center coordinate producing (x + 2)² instead of (x − −2)², or a center on an axis collapsing the parenthesis away entirely.
Standard form and general form, side by side
Both common shapes of the equation come back in the same response. The coefficients are also returned numerically as d, e and f, so code that needs the values rather than the string does not have to parse anything. The general form is derived deterministically: D is minus twice the center x, E is minus twice the center y, and F is h² + k² − r².
When a coefficient is zero it is omitted from the printed equation, so a circle centered at the origin reads simply x² + y² = r² in standard form and x² + y² − r² = 0 in general form, exactly as a teacher would write it on the board.
Strict input, honest errors
The radius must be a positive number. The same strictness applies to the center: both coordinates must be present and must be finite numbers, and numeric strings are accepted because form submissions so often arrive as text. This strictness matters for billing as well as correctness — an input that fails validation is never charged, because the error is the client's to fix, not a consumed computation.
What you can do with it
Generate homework and exam items
Feed randomized centers and radii and get the correct standard and general equations to print as answer keys, with no manual expanding.
Render circles in graphics code
Turn a center and radius from a drawing tool into the implicit equation a shader, plotter or geometry library expects.
Check student answers automatically
Compare a submitted general-form equation against the deterministic coefficients d, e and f instead of parsing handwritten algebra.
FAQ
What input does it need?
Three numbers: the x and y coordinates of the center and the radius. Numeric strings are accepted too.
What happens when the center is the origin?
Zero terms are omitted cleanly: you get x² + y² = r² in standard form and x² + y² − r² = 0 in general form.
Is the output deterministic?
Yes. There is no randomness, no clock and no network involved, and numbers are rounded to six decimals, so the same input always yields byte-identical output.
How do I turn the standard form into the general form?
Expand the squares and collect terms. The x coefficient is minus twice the center's x, the y coefficient is minus twice the center's y, and the constant is the sum of their squares minus the radius squared. In the example that gives −6, 4 and −12.
Why does a negative center coordinate turn into a plus sign?
Because subtracting a negative number means adding it. A center x of −2 gives (x + 2)², not (x − −2)², and the calculator writes it that way for you, dropping any term that comes out as zero.
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/math/circle-formula \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"cx":3,"cy":-2,"r":5}'const res = await fetch("https://api.kit.forhosting.com/math/circle-formula", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"cx": 3,
"cy": -2,
"r": 5
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/circle-formula",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"cx": 3,
"cy": -2,
"r": 5
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/circle-formula", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"cx":3,"cy":-2,"r":5}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"cx":3,"cy":-2,"r":5}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/circle-formula", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"cx": 3,
"cy": -2,
"r": 5
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.circle_formula",
"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.
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
The circle formula API takes the two things that define a circle — the coordinates of its center and its radius — and returns its equation in both standard form, (x − h)² + (y − k)² = r², and general form, x² + y² + Dx + Ey + F = 0, together with the numeric coefficients D, E and F. It is the algebra students do by hand and graphics code does at runtime, done deterministically in one call: same center and radius in, exactly the same equations out, every time.
From a center and a radius to an equation
This endpoint takes those three numbers — center x, center y and radius — and writes the equation for you.
Standard form and general form, side by side
The standard form keeps the geometry visible — you can read the center and the squared radius off it directly — while the general form, x² + y² + Dx + Ey + F = 0, is what textbooks ask for when expanding, and what many solvers accept as input.
Strict input, honest errors
Zero is rejected because a circle of radius zero is a point, not a circle, and negative radii are meaningless geometry; in both cases you get a clear invalid_input error naming the radius field instead of a silently wrong equation.
Technical questions
What does it cost?
$0.002 per request. It is also free to run in your browser on this page — the same code runs in both places.
Why was my radius rejected?
The radius must be a positive number. Zero and negative values return an invalid_input error, because they do not describe a circle.
Which forms of the equation are returned?
Both: the standard form (x − h)² + (y − k)² = r² and the general form x² + y² + Dx + Ey + F = 0, plus the numeric coefficients d, e and f.