ForHosting KIT · Math

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
Use it from WebAPIEmailTelegramApp soon
If you enter
A
5
B
3
You get
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.

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.

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.

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/ellipse-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/ellipse-circumference \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"a":5,"b":3}'
{
  "a": 5,
  "b": 3
}
{
  "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.

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 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.

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.

Read the full KIT documentation →