Cylinder density calculator
A solid cylinder with mass 1, diameter 2 and height 1 has a volume of π and a density of 1 over π, in matching units. Weigh the piece, measure its diameter and height, and get its density in one step. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Mass
- 1
- Diameter
- 2
- Height
- 1
- Radius
- 1
- Volume
- 3.1415926536
- Density
- 0.3183098862
A solid circular cylinder is one of the most common laboratory and workshop shapes: metal billets, plastic stock, concrete cores, food cans, and machined pins are all modeled as right circular cylinders. Density is mass divided by occupied volume, but when you hold a physical cylinder you usually know its mass, outer diameter, and height rather than a precomputed cubic volume.
What cylinder density means and how the formula is derived
Density of a uniform solid is mass per unit volume: rho equals m over V. For a right circular cylinder the enclosed volume is the base disk times the axial height. The base is a circle whose diameter is the measured outer diameter d, so the radius r is d divided by two and the base area is pi r squared, which is also pi d squared over four.
Multiplying by height h gives V equals pi d squared h over four. Substituting into the density definition yields the compact identity this calculator uses: rho equals four m over pi d squared h. That is the same result you would get by first calling a cylinder-volume tool and then dividing mass by the returned volume, except here the two steps are fused so a shop or classroom workflow never drops a digit between tools.
The model is a solid, not a tube: there is no inner radius and no wall thickness. A hollow pipe needs a different volume, outer disk minus inner disk, and a different capability. Diameter and height must share one length unit, and mass must be expressed in the matching mass unit; if lengths are metres and mass is kilograms, density is kilograms per cubic metre.
The engine never converts millimetres to metres or grams to kilograms, which keeps the contract transparent.
Where cylinder density helps, and which units to use
Machine shops, materials labs, and classrooms use a cylinder density calculator whenever a billet, core, can, or pin is weighed and measured with calipers but the material is unknown or the stock certificate needs a check against a published density. Quality teams compare the returned density with aluminium, steel, brass, polymer, or concrete tables to flag a wrong alloy or a porous pour. Tutoring platforms and exam generators need a deterministic oracle that rejects a zero diameter instead of silently dividing by zero.
Failed validation does not consume balance. Convert millimetres and grams before you call if your instruments report those units. Do not send inner diameter for a pipe and expect a solid-cylinder result.
Keep requests small, pin the rounded density in tests, and you get reproducible values for homework, shop-floor checks, and edge workers without standing up a computer-algebra system of your own.
What you can do with it
Shop-floor alloy and stock checks
Weigh a metal or polymer billet, measure outer diameter and length with calipers, and compare the returned density with published tables to confirm the alloy or catch mixed stock.
Classroom cylinder-density homework
Students submit mass, diameter, and height for a solid cylinder and verify rho equals four m over pi d squared h, including a clear error when a dimension is not positive.
FAQ
How do I calculate the density of a solid cylinder?
Send finite mass, a strictly positive diameter, and a strictly positive height. Density is ρ = 4m / (π d² h), which is mass divided by the cylinder volume π (d/2)² h. The response also returns radius and volume.
What happens if diameter or height is zero or negative?
A solid cylinder must have a positive diameter and a positive height; zero or negative lengths are rejected and are not billed.
Which units does the cylinder density calculator use?
Units are coherent. If mass is kilograms and diameter and height are metres, density is kg/m³. Convert millimetres or grams before calling; the engine does not change units.
How is this different from a generic density or cylinder-volume tool?
A generic density calculator wants mass and a precomputed volume. A cylinder-volume tool returns V from radius and height but not density. This capability fuses both: mass plus diameter plus height to density of a solid cylinder.
Can I use it for a hollow pipe or tube?
No. The formula assumes a solid cylinder with no inner hole, so the outer diameter of a pipe gives a wrong result. A pipe needs a different volume, the outer disk minus the inner disk, and therefore a different tool.
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/phys/density-cylinder \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"mass":1,"diameter":2,"height":1}'const res = await fetch("https://api.kit.forhosting.com/phys/density-cylinder", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"mass": 1,
"diameter": 2,
"height": 1
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/phys/density-cylinder",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"mass": 1,
"diameter": 2,
"height": 1
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/phys/density-cylinder", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"mass":1,"diameter":2,"height":1}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"mass":1,"diameter":2,"height":1}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/phys/density-cylinder", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"mass": 1,
"diameter": 2,
"height": 1
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "phys.density_cylinder",
"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
This solid cylinder density calculator applies the closed-form identity rho equals four times mass divided by pi times diameter squared times height: it converts diameter to radius, forms the cylinder volume pi r squared h, and divides mass by that volume. Diameter and height must be strictly positive; a zero or negative length is not a physical cylinder and the task fails with invalid_input instead of returning Infinity.
What cylinder density means and how the formula is derived
Identical numeric inputs always produce identical JSON because the path is pure floating-point arithmetic with no network, no language model, no random seed, and no wall clock.
Input contract, response shape, and non-positive diameter or height
Diameter is the outer diameter of the solid cylinder and height is the axial length; both must be strictly positive. Extremely large magnitudes that would overflow to Infinity are rejected. Example: mass one, diameter two, height one is a unit-radius cylinder of height one, so volume is pi and density is one over pi in coherent units. POST a JSON body with three required finite numbers: mass, diameter, and height. Mass is the measured mass of the piece and must be non-negative; a negative mass is unphysical and fails with invalid_input. Zero or a negative diameter, or zero or a negative height, is not a physical solid cylinder, and the task fails with invalid_input naming the field rather than returning Infinity or a hollow zero density. Each field may arrive as a JSON number or as a numeric string; missing fields, empty strings, and non-finite values fail and are not billed. Aliases are accepted so existing shop or lab payloads map without renaming: m and mass_kg for mass; d, D, and dia for diameter; h and H for height. On success the body echoes mass, diameter, and height, then radius as half the diameter, volume as pi r squared h, and density as mass over volume, plus a formula string restating rho equals four m over pi d squared h and method equal to solid_cylinder_density so clients can branch without sniffing shapes. Pair the response with your own unit labels if you need a printed certificate; this endpoint returns the numbers, not a formatted report.
Where a cylinder density API earns its keep, units, and price
Inventory and shipping tools estimate mass from a known material only after they already know density; this endpoint is the inverse: given mass and the two cylinder dimensions, recover density.
Integration use cases
Concrete cores and laboratory QC
Labs compute bulk density of drilled cylindrical cores or machined pins from mass and two lengths, then archive the deterministic JSON in a LIMS without a spreadsheet formula.
Technical questions
What does the cylinder density calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.