Ellipse circumference calculator
An ellipse with semi-axes 5 and 3 has a circumference of 25.526986, from Ramanujan's 1914 formula. Enter both semi-axes in the same unit, halving a full width first, and get the edge length in that unit. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- A
- 5
- B
- 3
- Circumference
- 25.526986
You send the semi-major axis a and the semi-minor axis b, and it returns the circumference computed with Ramanujan's celebrated approximation, accurate to a tiny fraction of a percent for any realistic shape. Both axes must be positive numbers, the result keeps whatever unit you measured in, and you can choose how many decimal places you want back.
Why the circumference of an ellipse is hard
A circle's circumference is just pi times the diameter, but the moment you stretch that circle into an ellipse the formula stops existing. The exact answer is an elliptic integral of the second kind, a function with no expression in elementary terms, which is why engineers and scientists have relied on approximations for centuries. The most famous of them was published by Srinivasa Ramanujan in 1914: C is approximately pi times the quantity 3(a+b) minus the square root of (3a+b)(a+3b), where a and b are the semi-axes.
The formula is remarkably accurate — for moderately elongated ellipses the error is far below one thousandth of a percent, and even for extremely flat ones it stays well under one percent. That combination of simplicity and precision is why this ellipse circumference calculator uses it: you get a number you can trust, computed deterministically, without the machinery of numerical integration.
How to measure a and b
The two inputs are the semi-axes, not the full widths. If your ellipse is described by its overall width and height — say a running track's oval is 100 meters long and 60 meters wide — divide each by two first: a is 50 and b is 30. The semi-major axis a is half the longest diameter and the semi-minor axis b is half the shortest, but the formula is symmetric, so swapping them changes nothing.
Both values must be positive finite numbers in the same unit, and the circumference comes back in that unit: centimeters in, centimeters out.
Accuracy, rounding and where it fits
For very elongated ellipses — think a hundred to one axis ratio — Ramanujan's first approximation is still good to a few parts per million, which covers orbits, racetracks, architectural arches, optics and machining tolerances with room to spare; if you ever need more, his second refinement exists, but in practice nobody reaches for it.
Typical callers are geometry pipelines normalizing shapes, CAD and CNC tooling estimating cut lengths or material usage, physics code tracking orbital paths, and educational tools demonstrating why one simple-looking curve resisted a closed form for so long.
What you can do with it
Estimate material for an elliptical cut
Feed the semi-axes of an elliptical tabletop or gasket and get the edge length you need to order trim, seal or banding for.
Normalize shapes in a geometry pipeline
Attach a perimeter to every detected ellipse in image or CAD processing without pulling in a numerical integration library.
Teach or check orbital and track geometry
Verify homework, racetrack lap distances or orbit path lengths against a deterministic reference value.
FAQ
How accurate is Ramanujan's formula?
For most ellipses the error is well below one thousandth of a percent; even at extreme 100:1 axis ratios it stays within a few parts per million.
Do I send the full width or the semi-axis?
The semi-axes: half of the longest diameter (a) and half of the shortest (b). Divide full width and height by two first.
What unit is the result in?
Whatever unit you measured the axes in. The computation is unit-agnostic: centimeters in, centimeters out.
What input is rejected?
Missing, zero, negative, non-numeric or non-finite axes, and a decimals value that is not an integer between 0 and 12.
What happens when both semi-axes are equal?
Then the ellipse is a circle, and Ramanujan's formula reduces exactly to 2·π·a. That makes the calculator safe to use even when some of your shapes turn out to be perfect circles.
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/ellipse-circumference \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"a":5,"b":3}'const res = await fetch("https://api.kit.forhosting.com/math/ellipse-circumference", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"a": 5,
"b": 3
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/ellipse-circumference",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"a": 5,
"b": 3
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/ellipse-circumference", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"a":5,"b":3}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"a":5,"b":3}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/ellipse-circumference", 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": 5,
"b": 3
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.ellipse_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.
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 ellipse circumference API answers a question that has no elementary closed-form answer: how long is the edge of an ellipse? It runs free in your browser on this page and costs $0.002 per request when you automate it through the API.
How to measure a and b
A degenerate case worth knowing is a equal to b, which is simply a circle; the formula then reduces exactly to 2·pi·a, which makes the endpoint a safe drop-in anywhere you already compute circle perimeters but occasionally receive elliptical shapes. Negative, zero or non-numeric axes are rejected with a clear invalid_input error.
Accuracy, rounding and where it fits
Each call is a single stateless computation with no data retained, billed at $0.002 per request.
Technical questions
What does it cost?
$0.002 per request. It is also free to run in your browser on this page, with the exact same result.
What happens if a equals b?
That is a circle, and the formula reduces exactly to 2·pi·a, so the endpoint handles circles correctly too.