Circumference to diameter
Wrap a tape around something round and turn that reading into its width: a circumference of 31.41592653589793 gives a diameter of 10. Handy for pipes, wheels and tree trunks you cannot measure straight across. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Circumference
- 31.4159265359
- Diameter
- 10
- Pi
- 3.1415926536
- Decimal places
- 6
The relationship is one of the oldest constants in mathematics: the diameter is always the circumference divided by PI, roughly 3.14159. You send one positive number and receive the diameter rounded half-up to the number of decimal places you choose, along with the PI value used and the input echoed back for traceability. It is a single deterministic calculation with no lookup tables, no guessing and no state, so the same input always produces the same output. Use it when a tape measure wraps around a pipe, a wheel or a tree trunk and you need the straight-line width for a drawing, a part specification or a materials order.
Why circumference divided by PI gives the diameter
Every circle, regardless of size, shares the same proportion between the distance around its edge and the distance across its middle. That proportion is PI, an irrational constant whose decimal expansion never ends or repeats. Because the circumference equals PI times the diameter, dividing a measured circumference by PI recovers the diameter exactly — there is no estimation step and no approximation beyond the precision of PI itself.
This matters in practice because wrapping a flexible tape around a round object is often far easier than holding a ruler across it, especially for large cylinders, cables, wheels or living trees where you cannot reach both edges at once. The circumference to diameter conversion turns that easy measurement into the number drawings, machinists and suppliers actually ask for.
Input rules, rounding and error behavior
Zero is rejected because a circle with no perimeter has no meaningful diameter, negative values are rejected because length cannot be negative, and non-numeric or infinite values are rejected because they cannot be divided by PI to produce a real result. The optional decimals field controls output precision: it defaults to six decimal places and accepts any integer from zero to twelve. Rounding is half-up, meaning a discarded digit of five or more raises the last kept digit, which matches how most people expect rounding to behave on paper.
Where this conversion earns its place in real workflows
This conversion shows up anywhere a round thing must be sized without direct access to its width. Plumbers wrap a tape around pipe insulation to order the right clamps; wheel and tire builders measure the bead circumference to confirm rim diameter; foresters measure trunk girth at breast height and derive diameter for growth records and timber estimates; engineers reverse-engineer unlabeled shafts and rollers by rolling them along a ruler to capture one circumference per revolution.
In software, the calculation is a frequent step inside geometry pipelines, CAD import filters and educational tools that let students move between the radius, diameter, circumference and area of a circle.
What you can do with it
Size a pipe from a tape measurement
Wrap a tape around an insulated pipe, send the circumference and get the diameter needed to order clamps, sleeves or fittings.
Convert tree girth into trunk diameter
Foresters measure circumference at breast height; dividing by PI yields the diameter used in growth records and timber volume formulas.
FAQ
What formula does it use?
The diameter equals the circumference divided by PI, using the double-precision constant 3.141592653589793 built into the runtime.
How is the result rounded?
Half-up to the number of decimals you request — six by default, any integer from zero to twelve — so the output is identical on every machine.
Can I convert the diameter back to a circumference?
Multiply the diameter by PI to recover the circumference.
Does the service store my measurements?
No. The input is processed in memory and discarded; only the computed result is returned.
How do I find a tree's diameter with a tape measure?
Wrap the tape around the trunk at breast height and enter that girth. Dividing it by PI gives the diameter for growth records or timber estimates, without having to reach across the trunk.
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/circumference-to-diameter \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"circumference":31.41592653589793}'const res = await fetch("https://api.kit.forhosting.com/math/circumference-to-diameter", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"circumference": 31.41592653589793
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/circumference-to-diameter",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"circumference": 31.41592653589793
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/circumference-to-diameter", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"circumference":31.41592653589793}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"circumference":31.41592653589793}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/circumference-to-diameter", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"circumference": 31.41592653589793
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.circumference_to_diameter",
"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 circumference to diameter API takes the distance around a circle and returns the distance across it. The exact same code runs free on this page, so you can verify a value by hand before wiring the endpoint into an automated workflow.
Why circumference divided by PI gives the diameter
The endpoint uses the double-precision value of PI built into the runtime, which is accurate to about fifteen significant digits, far beyond any physical measurement you will ever feed it. The result is then rounded half-up to your chosen number of decimals, so the output is stable and identical on every machine and every request.
Input rules, rounding and error behavior
The API accepts a single required field, circumference, which must be a positive finite number. When the input fails any of these checks the endpoint returns an invalid_input error that names the offending field, and — importantly — the call is not billed, because a request that never ran the calculation consumed nothing. The response object contains the computed diameter, the circumference you sent, the exact PI constant used and the decimals applied, so every result carries its own provenance and can be reproduced or audited later without re-calling the service.
Where this conversion earns its place in real workflows
Embedding this endpoint in those pipelines replaces a hand-rolled division with a versioned, validated and tested contract: invalid inputs are caught at the boundary instead of propagating NaN values downstream, and the rounding rule is documented and stable. At $0.002 per request with no per-unit surcharge it is cheap enough to call on every record of a batch job, and the free browser version on this page runs the identical module, so what you test interactively is exactly what the API returns in production.
Integration use cases
Validate geometry in an automated pipeline
Call the endpoint per record in a batch job and let strict input validation reject zero, negative or non-numeric circumferences before they corrupt downstream calculations.
Technical questions
What does it cost?
$0.002 per request, with no per-unit surcharge. It is also free to run in your browser on this page with the identical code.
Which inputs are rejected?
Zero, negative, non-numeric and non-finite circumferences all return an invalid_input error naming the field, and those calls are not billed.