ForHosting KIT · Math

Capsule volume & surface area

Get the volume, surface area and total height of a capsule, a cylinder capped by two hemispheres: a radius of 2 and a straight section of 5 give a total height of 9. Handy for tanks with domed ends and pill shapes. 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
2
Length
5
You get
Total height
9
Volume
96.3421747101
Surface area
113.0973355292

A capsule—also called a stadium of revolution or a spherocylinder—is a finite cylinder capped by two hemispheres of the same radius. You supply the shared radius and the length of the cylindrical mid-section only; this capability returns the solid volume, the full closed surface area, and the total height including both caps. Engineers, product designers, and students use these numbers for tanks, pill-shaped packaging, capsules in physics engines, and homework that must match the closed-form formulas.

Formulas: volume and surface of a stadium of revolution

The two hemispheres together are one sphere, so you never add two separate hemisphere volumes unless you are careful to use two-thirds each; the closed form above is safer. The closed surface area is the lateral area of the cylinder plus the full sphere surface: A equals two π r L plus four π r squared. There is no extra “end disk” term because the cylinder ends are not free surfaces—they are fused into the hemispheres.

When L is zero the formulas collapse to the familiar sphere volume and surface, which is a useful sanity check. Complexity is constant: a handful of multiplications and divisions with no loops, no tables, and no iterative solvers. Prefer this path for design estimates, CAD cross-checks, and teaching demos rather than for mesh-based numerical integration of non-circular cross-sections.

Where capsule volume and area show up in practice

Mechanical and process engineers size cylindrical tanks with hemispherical heads, estimate hold-up volume, and rough-check surface coatings or insulation area without opening a full CAD session. Pharmaceutical and consumer-product teams model softgel and hard-capsule shells where the body is a cylinder and the ends are domes, needing volume for fill targets and outer area for coating load. Game and physics developers validate analytic collision or buoyancy volumes against mesh approximations and need a trusted closed form for pill-shaped rigid bodies.

Educators and students generate homework answers that must match textbook stadium-of-revolution exercises without spreadsheet formula drift. Prefer this tool when the search intent is “capsule volume calculator” or “spherocylinder surface area,” not when you need open cylinders, ellipsoids of three unequal axes, or numerical CFD.

Tank and vessel capacity checks

Estimate the internal volume of a cylindrical vessel with hemispherical ends from radius and mid-section length before ordering fabrication.

Pill and capsule packaging fill

Convert softgel geometry into fill volume and outer surface for coating or labeling estimates in product development.

Physics and CAD cross-checks

Compare mesh-derived volumes of pill-shaped bodies against the closed-form capsule formulas in tests and design reviews.

What does it cost?

The same calculation also runs free in your browser on this page.

What is the cylindrical length?

It is the straight mid-section only, not including the two hemispherical caps. Total height is length + 2×radius.

Why was my request rejected?

Radius must be positive. Length must be non-negative.

What if length is zero?

You get a pure sphere: volume (4/3)πr³ and surface 4πr², with total height 2r.

Which units are supported?

Any consistent length unit. Outputs are in cube and square of that unit; convert before calling if needed.

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/geom/capsule

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/geom/capsule \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"radius":2,"length":5}'
{
  "radius": 2,
  "length": 5
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "geom.capsule",
  "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.

Non-positive radius is rejected with invalid_input before any volume is invented.

Inputs, outputs, and the capsule definition

Both values share the same length unit—meters, millimeters, or inches—because the capability is unit-agnostic and simply returns volume in cube of that unit and area in square of that unit. Prefer this contract when the solid is a true capsule with hemispherical ends, not an open cylinder, a full torus, or a stadium in two dimensions. Send a JSON object with two required numbers: radius (must be strictly positive) and length (the cylindrical mid-section length, which may be zero for a pure sphere and must not be negative). The response echoes radius and length, adds total_height equal to length plus twice the radius, and reports volume and surface_area as IEEE floating-point numbers from Math.PI. Missing fields, booleans, empty strings, non-numeric text, infinite values, zero or negative radius, and negative length all raise invalid_input with a message that names the field and the rule. That failure mode is intentional: a bad radius must never produce a fake tank capacity. Pricing is $0.002 per request on the API; the identical algorithm also runs free in your browser on this page when you only need an occasional check.

Formulas: volume and surface of a stadium of revolution

The volume is the cylinder volume plus the volume of a full sphere of the same radius: V equals π r squared times L, plus four-thirds π r cubed.

Where capsule volume and area show up in practice

Because the capability is tier A, you can paste radius and length on this page and run the same logic free in the browser; automate later at $0.002 per task when scripts or SDKs need batches. Keep radius positive, treat invalid_input as a client fix rather than a retry, and convert units yourself so both inputs stay consistent before you call.

Read the full KIT documentation →