ForHosting KIT · Math

Cylinder volume in gallons

Turn a cylinder measured in inches into US gallons: a radius of 6 inches and a height of 48 inches hold 23.500745 gallons. Handy for aquariums, fermenters, water heaters, rain barrels and drums. 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
6
Height
48
You get
Volume gallons
23.500745

Plumbers, aquarists, home brewers and anyone sizing a tank in the United States run into the same arithmetic over and over: a cylinder measured in inches whose capacity is needed in gallons. This capability answers exactly that. You send the radius of the base and the height, both in inches, and you get back the volume in US liquid gallons in a single deterministic call — the cylinder volume πr²h in cubic inches, divided by the exact conversion of 231 cubic inches per gallon.

From inches to gallons: the math

With the radius r and the height h both measured in inches, that formula yields cubic inches directly. The conversion to US liquid gallons is not an approximation but an exact definition: one US gallon is exactly 231 cubic inches, a value fixed by law since the nineteenth century. If what you measured is the diameter rather than the radius, halve it before calling; sending the diameter as the radius would overstate the volume by a factor of four, because the radius enters the formula squared.

Note also that this is the US liquid gallon: the imperial gallon used in the UK and Canada is about 20% larger (277.42 cubic inches), so results are not interchangeable across the two systems.

Where gallons-from-inches shows up

Tank and container capacity in gallons is a daily question in American trades, and inches are the working unit of the tape measure. Aquarium keepers size tanks and sumps; home brewers and winemakers verify fermenter capacity; plumbers and well contractors compute the drawdown volume of pressure tanks and water heaters; HVAC and boiler technicians estimate the fluid volume of cylindrical vessels; and anyone buying a rain barrel, a fuel drum or a stock tank wants to know what the manufacturer's dimensions actually hold.

The standard 55-gallon drum is the classic sanity check: about 11.5 inches of radius and 33.5 inches of height give almost exactly 55 gallons.

Check aquarium and sump capacity

Get the true gallon capacity of a cylindrical tank, sump or refugium from its radius and height in inches before stocking or dosing.

Size brewing and fermentation vessels

Verify how many gallons a fermenter, kettle or barrel actually holds from two tape-measure readings in inches.

Compute pressure tank and drum volume

Estimate the gallons contained in a well pressure tank, water heater or 55-gallon drum from its cylindrical dimensions.

Is this US gallons or imperial gallons?

US liquid gallons. The imperial gallon is about 20% larger (277.42 cubic inches), so do not mix the two systems.

I measured the diameter, not the radius. What do I send?

Divide the diameter by two first. The formula is πr²h, and sending the diameter as the radius would give four times the true volume.

Can I control the precision?

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

Why is the volume divided by 231?

Because one US liquid gallon is exactly 231 cubic inches, a value fixed by law since the nineteenth century. The cylinder's volume in cubic inches divided by 231 gives gallons with no approximation.

How can I check the result against a 55-gallon drum?

A standard drum has a radius of about 11.5 inches and a height of about 33.5 inches. Entering those gives almost exactly 55 gallons, a quick sanity check for your own measurements.

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-volume-gallons

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-volume-gallons \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"radius":6,"height":48}'
{
  "radius": 6,
  "height": 48
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "math.cylinder_volume_gallons",
  "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.

Both inputs are validated as positive finite numbers before any math happens, and anything else is rejected with a typed invalid_input error that names the offending field, so a bad measurement never turns into a silently wrong capacity figure.

From inches to gallons: the math

A right circular cylinder is a circle extruded along a straight axis, so its volume is the area of the base times the height: V = πr²h. This endpoint therefore computes πr²h and divides by 231 — no empirical factors, no lookup tables, no temperature corrections.

Validation, precision and rounding

The two inputs are checked before any arithmetic: both radius and height must be positive finite numbers. Once the inputs pass, the volume 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. Zero, 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 "6.5" are accepted and coerced, which makes the endpoint friendly to form data and query parameters. The response echoes the exact radius and height that were used, so a single payload is a complete record of what was computed.

Where gallons-from-inches 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 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 dimensions — for example sizing a tank against a capacity target — 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.

Which units does it use?

Radius and height are in inches. The cylinder volume is computed in cubic inches and converted with the exact definition 1 US liquid gallon = 231 cubic inches.

What input is rejected?

Anything that is not a positive finite number: zero, negative values, non-numeric strings, NaN, infinity and missing fields all return a typed invalid_input error.

Read the full KIT documentation →