ForHosting KIT · Science

Volume to density calculator

Divide a sample's mass by the volume it occupies and get its density: 10 kg in 2 m³ gives 5 kg/m³, and grams over cubic centimetres give g/cm³. Made for lab checks, homework and receiving inspection. 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
Mass
10
Volume
2
You get
Density
5

Density is mass per unit volume, and the everyday physics step is one-way: you already weighed a sample and you already know the space it occupies, so the remaining unknown is density itself. This volume-to-density calculator accepts those two measured numbers, divides mass by volume, and returns density in coherent units—kilograms per cubic metre when mass is kilograms and volume is cubic metres, or grams per cubic centimetre when you send grams and cubic centimetres. Volume must be strictly positive.

What volume-to-density means and why volume must be positive

Density of a uniform body is defined as mass divided by the volume that body occupies. In a physics laboratory that definition is almost never an algebraic rearrange among three unknowns: you weigh the sample on a balance, you measure or compute the volume from liquid displacement, a pycnometer, calipers plus a geometric formula, or a stated container fill, and you want density as the quotient. Send mass m and volume V; receive density rho equals m over V.

SI coherent units are kilograms, cubic metres, and kilograms per cubic metre, but the engine never converts millilitres to cubic metres or grams to kilograms. If you send grams and cubic centimetres, the density is grams per cubic centimetre, which for many student tables equals the specific gravity relative to water near four degrees Celsius. Volume must be strictly greater than zero because a vanishing or inverted sample volume does not define a physical density.

Where it helps and which units to use

Physics classrooms, materials labs, and quality teams use a volume-to-density calculator whenever mass and volume are already known and the remaining question is whether the sample matches a published material. Students check homework that states a metal slug of given grams occupying a given number of millilitres. Metrology benches weigh a pycnometer fill and divide by the known flask volume.

Receiving inspection weighs a polymer pellet batch and divides by a measured hopper volume to flag moisture uptake or a wrong resin. Tutoring platforms and exam generators need a deterministic oracle that rejects a zero or negative volume instead of silently returning Infinity. Failed validation does not consume balance.

Convert millilitres and grams before you call if your instruments report those units. Keep requests small, pin the rounded density in tests, and you get reproducible values for homework, receiving inspection, and edge workers without standing up a computer-algebra system of your own.

Lab mass and displacement volume

Weigh a sample, measure occupied volume by displacement or pycnometer, and convert the pair into density in coherent units for a material check.

Receiving inspection of bulk solids

Divide a weighed hopper or bag mass by a measured fill volume to flag the wrong resin, moisture uptake, or mixed stock against a published density.

How do I compute density from mass and volume?

Send two finite numbers: mass (non-negative) and volume (strictly positive).

What happens if volume is zero or negative?

Density is undefined for a vanishing sample volume, and a negative volume is not a physical occupied volume, so those requests are not billed.

What units should I use for mass and volume?

Use any coherent pair. Kilograms and cubic metres yield kg/m³; grams and cubic centimetres yield g/cm³. The engine does not convert units for you.

Does this calculator also solve for mass or volume?

No. This is the one-way physics step from measured mass and volume to density. It does not rearrange ρ = m/V for the other two unknowns.

How can a density check reveal the wrong material?

Compare the result with the published density of the material you expect. Receiving inspection, for example, weighs a batch of polymer pellets, divides by the measured volume and flags moisture uptake or a wrong resin.

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/phys/volume-to-density

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/phys/volume-to-density \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"mass":10,"volume":2}'
{
  "mass": 10,
  "volume": 2
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "phys.volume_to_density",
  "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.

A zero volume or a negative volume is not a physical sample, so the task fails with invalid_input instead of Infinity or a signed nonsense result.

What volume-to-density means and why volume must be positive

This endpoint is that one-way step. Zero volume would make the quotient undefined and would yield Infinity in IEEE floating point, which this product refuses to publish as a successful result. A negative volume is equally unphysical for a laboratory sample: it is not a signed flux or a change in volume, it is a bad measurement or a sign error, and the task fails with invalid_input. Identical numeric inputs always produce identical JSON because the path is pure division with no network, no language model, no random seed, and no wall clock.

Input contract, response shape, and zero or negative volume

Volume is the occupied volume and must be strictly positive. Extremely large magnitudes that would overflow to Infinity are rejected. This calculator does not solve for mass from density and volume, and it does not solve for volume from mass and density: those rearranges belong to a different workflow. It also does not convert units, compute cylinder or sphere volume from dimensions, or look up material tables. Example: mass ten and volume two yields density five in coherent units. Example: mass one and volume three yields one third, rounded stably. Failed validation is not billed. POST a JSON body with two required finite numbers: mass and volume. Mass is the measured mass of the sample and may be zero; a negative mass, a non-finite value, or a missing field fails with invalid_input naming the field. Zero volume and negative volume both fail with invalid_input and a message that volume must be positive because zero or negative volume is invalid for rho equals m over V. Each field may arrive as a JSON number or as a numeric string; empty strings are treated as missing. Aliases are accepted so existing lab payloads map without renaming: m and mass_kg for mass; V, vol, and volume_m3 for volume. On success the body echoes mass and volume, then density as mass divided by volume, plus a formula string restating rho equals m slash V and method equal to volume_to_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 volume-to-density API earns its keep, units, and price

Do not send a geometric diameter and expect this endpoint to form a cylinder volume—that is a different calculator.

Classroom density homework

Students submit mass and volume and verify ρ = m/V, including a clear invalid_input error when volume is zero or negative.

What does the volume to 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.

Read the full KIT documentation →