Density calculator
Give any two of mass, volume and density and the calculator works out the third: 10 kg in 2 m³ is a density of 5 kg/m³. It also tells you which quantity it solved, so you can tell measured from calculated. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Mass m in kilograms
- 10
- Volume
- 2
- Density
- 5
- Solved
- density
Lab notebooks, process sheets, and homework all rearrange that single definition to find an unknown sample mass, the volume of a container filled with a known substance, or the density itself when both mass and volume are measured. This capability accepts exactly two of mass, volume, and density, solves for the third with deterministic floating-point arithmetic, and returns the full triad plus a solved label so downstream forms and graders know which field was computed. Zero volume is rejected with a clear invalid input error because division by zero is undefined for rho equals m over V.
Reading the response: triad, solved flag, and formula label
Use mass alone when a process sheet only needs fill weight from tank volume and material density. Use volume when packaging or shipping tools convert a known mass of product into estimated cubic capacity under a stated bulk density. Use density when laboratory or classroom checks compare measured mass and volume against a published material density.
Source inputs follow the same retention rules as other KIT parse items, and results are safe to pin in automated tests because the algorithm is fully deterministic and free of external data.
Zero volume, units and practical limits
Call the free in-browser density calculator for classroom demos, lab notebooks, and quick mental checks without installing a spreadsheet or CAS. Zero density is rejected when volume is the unknown, because mass divided by zero density is undefined. Non-finite or out-of-range magnitudes fail the same way so workers never return Infinity or NaN.
Convert units before you call: the engine will not turn millilitres into cubic metres or grams into kilograms for you, which keeps the contract simple and transparent. Authors shipping SDKs can map the triad fields directly into form widgets that highlight the solved quantity—the same three-column layout students see when they rearrange the density formula by hand.
What you can do with it
Lab mass and volume to density
Technicians enter weighed mass and measured volume; the calculator returns density for material checks, certificates of analysis, and lab notebook tables.
Tank fill mass from density
Process sheets multiply known material density by tank or pipe volume to estimate fill mass without retyping spreadsheet formulas.
Homework density formula practice
Students and graders solve for any one of mass, volume, or density, and get a clear error when volume is submitted as zero by mistake.
FAQ
How do I calculate density from mass and volume?
The response includes density equal to mass divided by volume, plus solved set to density.
Can I solve for mass or volume instead of density?
Yes. Provide density with volume to get mass, or mass with density to get volume. Always send exactly two of the three fields and omit the unknown.
Is the density calculator free?
The browser tool runs free on your device.
Does this convert units like g/mL to kg/m³?
No. Use coherent units yourself (for example both SI or both cgs). The engine rearranges ρ=m/V only; unit conversion is out of scope.
What happens if I enter all three values?
The calculator refuses. You must leave exactly one of mass, volume and density empty, so it never overwrites a value you measured. Entering only one value is refused for the same reason.
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/chem/density-mass-volume \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"mass":10,"m":1}'const res = await fetch("https://api.kit.forhosting.com/chem/density-mass-volume", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"mass": 10,
"m": 1
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/chem/density-mass-volume",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"mass": 10,
"m": 1
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/chem/density-mass-volume", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"mass":10,"m":1}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"mass":10,"m":1}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/chem/density-mass-volume", 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": 10,
"m": 1
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "chem.density_mass_volume",
"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
Density is mass per unit volume: rho equals mass divided by volume.
What density means and which two fields to send
Density rho is defined as mass m divided by volume V when the sample is treated as uniform. In SI, mass is kilograms, volume is cubic metres, and density is kilograms per cubic metre; the same algebra works for grams per cubic centimetre or any other coherent pair, because the engine does not convert units—it only rearranges numbers you already expressed consistently. Typical workflows are: weigh a sample and measure its displaced volume to get density; multiply a known density by a tank volume to estimate mass; or divide a bag mass by density to estimate occupied volume. Provide exactly two JSON fields among mass, volume, and density. Aliases are accepted: m or mass_kg for mass; V, vol, or volume_m3 for volume; rho, the Greek letter rho, or d for density. Numeric strings are parsed the same way as JSON numbers. If you send none, one, or all three quantities, the request fails with invalid_input so callers cannot accidentally overwrite a measured value. Identical inputs always produce identical JSON because the path is pure arithmetic with no network, no random seed, and no wall clock.
Reading the response: triad, solved flag, and formula label
On success the response echoes mass, volume, and density with stable rounding suitable for snapshots, plus solved equal to mass, volume, or density depending on which quantity was missing from the request. The formula field is always the Unicode rho equals m slash V identity, and method is always density_mass_volume so clients can branch without sniffing shapes. Validation failures—including missing pairs, non-finite numbers, zero volume, and zero density while solving for volume—return invalid_input and are not charged after the engine rejects the request. The free browser density calculator is ideal for quick homework checks and bench-side estimates; the prepaid API at $0.002 per successful item is the right path when a LIMS, ERP, or tutoring platform needs a stable contract under KIT balance.
API usage, zero-volume errors, units, and practical limits
Send a JSON body with exactly two of the three fields mass, volume, and density. Use the prepaid API when an inventory system, chemistry homework grader, quality-control pipeline, or process calculator needs the same rearrange of rho equals m over V at $0.002 per successful item. Zero volume is always invalid_input, whether supplied as an input or produced as a computed result from inconsistent mass and density, because density is undefined for a vanishing sample volume under this product contract. Pair this endpoint with molar-mass or concentration tools when the next step is chemistry stoichiometry, or with pressure and force calculators when density feeds fluid statics.
Technical questions
What happens if volume is zero?
The request fails with invalid_input. Zero volume is rejected because ρ=m/V is undefined when volume is zero, and the call is not charged.