Circle length calculator
Work out the length around a circle from whichever measurement you have, the radius or the diameter, where a radius of 5 gives 31.415927. The result also tells you which of the two it used. Handy for belts, wheels and garden edging. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Radius
- 5
- Circumference
- 31.415927
- Given
- radius
The same code that answers here runs free in your browser on this page.
From one measurement to the full length around
Every circle carries the same relationship: the distance around it is π times the distance across it. If you know the diameter — the straight line through the center from edge to edge — the circumference is simply π·d. If you know the radius — the distance from the center to the edge — the circumference is 2·π·r.
You provide exactly one of the two fields, and the response tells you both the circumference and which input it used, under the key <em>given</em>. This matters in practice because measurements arrive in whatever form the tool at hand produces: a caliper gives you a diameter, a drawing marks a radius, a spec sheet either one.
Precision, rounding and validation you can rely on
The computation uses the double-precision value of π built into the runtime (3.141592653589793) and rounds the result half-up to a fixed number of decimal places — six by default, adjustable from zero to twelve with the <em>decimals</em> field. Half-up rounding to a fixed decimal count is a deliberate choice: it makes the output stable and identical on any machine, so a result you assert in a test today still matches byte for byte next year on different hardware. Validation is equally strict.
The <em>decimals</em> field itself must be an integer inside its range.
Where a circumference lookup fits in real work
Circumference is the hidden quantity behind many everyday estimates. A fabricator cutting a belt or a band for a drum needs the length around the drum, not its width. A cyclist setting a wheel size in a trip computer enters a circumference derived from the wheel radius.
A teacher building exercises wants a reliable generator of correct answers, and a gardener ordering edging for a circular bed needs the perimeter before the price quote. In software, the value often feeds a larger computation: material length, travel distance per revolution, or the spacing of marks around a dial. If you need the diameter from any circle measurement, that inverse lookup exists as a separate capability; if you need every circle property at once, the general circle calculator covers that.
This one answers the single question "how long is the way around?" and nothing else.
What you can do with it
Cut material for a round object
Get the exact strip, belt or cable length needed to wrap a drum, pipe or wheel from its measured diameter before ordering material.
Feed a distance-per-revolution calculation
Compute wheel circumference from its radius to calibrate odometers, rotary encoders and trip computers.
Generate verified geometry answers
Produce deterministic circumference values for exercises, tests or CAD checks, with rounding that matches byte for byte across machines.
FAQ
Which inputs does it accept?
Exactly one of radius or diameter, as a positive finite number. Sending both or neither returns an invalid input error.
Can I control the precision of the result?
Yes. The decimals field sets the number of decimal places, from 0 to 12, with half-up rounding. It defaults to 6.
What happens if the radius is zero or negative?
The measurement must be a positive finite number.
Does the result keep my unit?
Yes. The circumference is returned in the same unit as the radius or diameter you provided; no unit conversion is applied.
What if I enter both the radius and the diameter?
The calculator refuses and asks for just one. Two measurements at once usually mean a mistake somewhere, and it is better to catch it than to have one of the values picked silently.
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-length \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"radius":5}'const res = await fetch("https://api.kit.forhosting.com/math/circle-length", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"radius": 5
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/circle-length",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"radius": 5
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/circle-length", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"radius":5}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"radius":5}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/circle-length", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"radius": 5
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.circle_length",
"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 length API computes the circumference of a circle — the distance around its edge — from a single measurement you already have: either the radius or the diameter. You send one positive number, and it returns the circumference using the exact formulas C = 2·π·r or C = π·d, rounded half-up to the number of decimal places you choose. It is a small, deterministic answer to a question that shows up in engineering, fabrication, education and design every day, delivered in one request instead of a spreadsheet cell or a calculator app.
From one measurement to the full length around
The circle circumference calculator endpoint applies exactly one of these two formulas depending on which field you send, so you never need to convert between radius and diameter yourself or remember which factor goes where. The endpoint refuses to guess: if you send both fields, or neither, it answers with an invalid input error instead of silently picking one, because two numbers in one request usually mean a bug in the caller that you want surfaced immediately rather than averaged over.
Precision, rounding and validation you can rely on
The measurement must be a positive finite number; zero, negative values, non-numeric input and infinities are rejected with an <em>invalid_input</em> error, which is never charged. Because the endpoint is purely deterministic — no network calls, no randomness, no clock — the same input always produces the same output. That property is what lets the free browser version on this page run the identical module and promise exactly what the paid API returns, and it is what makes the endpoint safe to embed in retry loops and cached pipelines.
Where a circumference lookup fits in real work
The endpoint is designed for exactly these call sites: one measurement in, one number out, priced at $0.002 per request and free for interactive use in the browser. It does not compute area, diameter from circumference, or other circle properties on purpose — narrow tools are easier to trust and to test.
Technical questions
What does it cost?
$0.002 per request. It is also free to run in your browser on this page.
Which formula is used?
C = 2·π·r from the radius, or C = π·d from the diameter, with π = 3.141592653589793.