ForHosting KIT · Math

Cylinder circumference

Get the perimeter of a cylinder's round base from its radius or diameter, so a radius of 3 gives 18.849556. That is the wrap length for a label, sleeve, gasket or band clamp, or the flat blank to roll into a tube. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Radius
3
You get
Diameter
6
Circumference
18.849556

Wrapping a label around a bottle, cutting a gasket for a pipe flange, or sizing a band clamp for a duct all start with the same question: how long is the perimeter of that cylinder's circular base? This capability answers exactly that. You send the radius or the diameter of the base — whichever your tape measure gave you — and you get back the circumference in a single deterministic call, with no manual 2πr arithmetic and no unit guessing. The same code runs free in your browser on this page.

Validation, precision and rounding

The input is checked before any arithmetic: the radius or diameter must be a finite number, zero or positive. A radius of zero is valid and returns a circumference of zero, a degenerate but well-defined answer. Once the input passes, the circumference is computed in double precision and rounded to the requested number of decimal places — six by default, anywhere from zero to twelve via the optional <em>decimals</em> field — using a half-up rule applied to the absolute value.

Where a cylinder's circumference shows up

The perimeter of a cylinder's base is one of the most quietly useful numbers in fabrication, packaging and maintenance. Label and sleeve printing needs the exact wrap length of a bottle, can or jar so the artwork meets edge to edge without overlap or gap.

Gasket and O-ring sizing, band clamps, pipe insulation jackets, and the flat blank you cut before rolling sheet metal into a tube all reduce to πd once you have a tape or caliper reading — and for a pipe you can only reach from the outside, measuring the circumference with a tape and dividing by π is also the standard trick for getting the diameter you cannot measure directly.

Size labels and shrink sleeves

Get the exact wrap length of a bottle, can or jar from its diameter so printed labels and sleeves meet edge to edge.

Cut gaskets and band clamps

Compute the perimeter of a pipe flange or duct from a caliper or tape reading to size gaskets, O-rings and clamps.

Roll sheet metal into tubes

Find the flat blank length needed before rolling sheet stock into a cylinder of a target radius or diameter.

Should I send the radius or the diameter?

Either one. If radius is present it is used; otherwise the diameter is halved first.

Which units does the result use?

The same unit as your input. A radius in centimeters gives a circumference in centimeters; a diameter in inches gives inches. No conversion is applied.

Can I control the precision?

Yes. The optional decimals field sets the decimal places of the circumference, from 0 to 12, with six as the default. Rounding is half-up.

Is my input stored anywhere?

No. The computation is a pure function: the radius or diameter is processed in memory and discarded, and only the circumference is returned.

How do I find a pipe's diameter when I can only reach the outside?

Wrap a tape around it to measure the circumference, then divide by π. That is the standard trick for pipes and posts whose centre you cannot reach to measure across directly.

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.

POSThttps://api.kit.forhosting.com/math/cylinder-circumference

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.

curl -X POST https://api.kit.forhosting.com/math/cylinder-circumference \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"radius":3,"r":1}'
{
  "radius": 3,
  "r": 1
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "math.cylinder_circumference",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

The input is validated before any math happens: a negative value, a missing field, an unparseable string, NaN or infinity are all rejected with a typed invalid_input error that names the offending field, so bad data never turns into a silently wrong cut length.

The formula behind the number

Because the diameter d is exactly twice the radius, the same formula is often written C = πd, which is the more convenient form when you measured across the widest part of the cylinder instead of from the center. The result carries the same unit as your input: a radius in centimeters gives a circumference in centimeters, a diameter in inches gives inches, with no conversion factor applied or needed. The base of a right circular cylinder is simply a circle, so its circumference is the classic circle perimeter: C = 2πr, where r is the radius of the base. This endpoint applies that closed formula exactly as written: nothing is approximated except the mathematical constant π itself, which JavaScript carries to double precision. You may send either measurement — if the radius is present it is used directly, otherwise the diameter is halved first — and the response echoes both the radius and the diameter that were used, so one payload is a complete record of the computation.

Validation, precision and rounding

A negative value, a missing field, an unparseable string, NaN or infinity are all rejected with a typed <em>invalid_input</em> error whose message names the field at fault — an error that is never billed, because it is the caller's data that failed, not the service. Numeric strings such as "3.5" are accepted and coerced, which makes the endpoint friendly to form data and query parameters.

Where a cylinder's circumference shows up

The capability runs as a pure function on our global edge: nothing is stored, nothing is sent to any third party, and the same code that answers paid API calls runs free in your browser on this page, so you can sanity-check a measurement interactively before automating anything. At $0.002 per request with no per-unit component, a batch job that sweeps thousands of candidate diameters — for example sizing a label against a product line of containers — costs exactly what the catalog says, with no surprises.

What does it cost?

$0.002 per request, with no per-unit component. It is also free to run in your browser on this page.

What input is rejected?

A negative value, an unparseable string, NaN, infinity and a missing radius-or-diameter field all return a typed invalid_input error. Zero is accepted and returns zero.

Read the full KIT documentation →