# Density Calculator

> Solves ρ = m / V for whichever of density, mass or volume is omitted, and reports density in kg/m³ and g/cm³, volume in litres and cm³, and the specific gravity relative to water.

- Calculator id: `density-mass-volume` · Category: Physics (`physics`) · Tool name: `solve_density`
- Canonical page: https://tttkmbb.com/physics/density-mass-volume · This document: https://tttkmbb.com/physics/density-mass-volume.md · JSON definition: https://tttkmbb.com/physics/density-mass-volume.json

## Purpose

Solves ρ = m / V for whichever of density, mass or volume is omitted, and reports density in kg/m³ and g/cm³, volume in litres and cm³, and the specific gravity relative to water.

**Use when:** You know two of mass, volume and density of an object or substance and need the third, e.g. the mass of a steel block, the volume of a litre of oil, or whether an object floats.

**Do not use when:** The substance is a gas whose density depends strongly on pressure and temperature (use ideal-gas-law), or you need the volume of a shape first (use sphere, cylinder or rectangular-prism).

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `mass_kg` | number | kg | optional | Mass in kilograms (1 g = 0.001 kg). Omit to solve for it. (min 0) |
| `volume_m3` | number | m³ | optional | Volume in cubic metres (1 L = 0.001 m³, 1 cm³ = 1e-6 m³). Omit to solve for it. (> 0) |
| `density_kg_m3` | number | kg/m³ | optional | Density in kg/m³ (1 g/cm³ = 1000 kg/m³; water ≈ 1000, steel ≈ 7850, aluminium ≈ 2700). Omit to solve for it. (> 0) |

## Output

| Field | Type | Unit | Description |
| --- | --- | --- | --- |
| `solved_for` | string |  | Which quantity was computed: density_kg_m3, mass_kg or volume_m3. |
| `density_kg_m3` | number | kg/m³ | ρ = m / V. |
| `density_g_cm3` | number | g/cm³ | Density in grams per cubic centimetre (= kg/L). |
| `mass_kg` | number | kg | Mass in kilograms. |
| `mass_g` | number | g | Mass in grams. |
| `volume_m3` | number | m³ | Volume in cubic metres. |
| `volume_l` | number | L | Volume in litres. |
| `volume_cm3` | number | cm³ | Volume in cubic centimetres. |
| `specific_gravity` | number |  | Density relative to water at 1000 kg/m³; below 1 the object floats in water. |
| `floats_in_water` | boolean |  | True when the density is below 1000 kg/m³. |

## Formula

`density_kg_m3 = mass_kg / volume_m3; mass_kg = density_kg_m3 × volume_m3; volume_m3 = mass_kg / density_kg_m3; density_g_cm3 = density_kg_m3 / 1000; specific_gravity = density_kg_m3 / 1000`

## Data Sources

- Wikipedia – Density — https://en.wikipedia.org/wiki/Density (reference, retrieved 2026-09-23)
- NIST Special Publication 811 – Guide for the Use of the SI, Appendix B (conversion factors) — https://www.nist.gov/pml/special-publication-811 (standard, retrieved 2026-09-23)

Data freshness: `static`. Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output.

## API

- `GET https://tttkmbb.com/api/v1/calculate/density-mass-volume?`
- `POST https://tttkmbb.com/api/v1/calculate/density-mass-volume` with JSON body `{"inputs": {…}}`
- Response: unified envelope (`success`, `request`, `result.values`, `result.units`, `sources`, `freshness`, `timestamp`, `next_actions`, `links`); see https://tttkmbb.com/docs/response-format.md
- Schema: https://tttkmbb.com/api/v1/calculators/density-mass-volume · OpenAPI operationId `solve_density` in https://tttkmbb.com/openapi.json
- Authentication: none. Rate limit: fair use, see https://tttkmbb.com/docs/rate-limits.md.

## MCP

- Server: `https://tttkmbb.com/mcp` (Streamable HTTP, JSON-RPC 2.0, no auth)
- Tool:  `run_calculator` with `{"calculator_id": "density-mass-volume", "inputs": {…}}`

## Example

- 2 kg in 2.5 L: inputs `{"mass_kg":2,"volume_m3":0.0025}` → `{"solved_for":"density_kg_m3","density_kg_m3":800,"density_g_cm3":0.8,"volume_l":2.5,"specific_gravity":0.8,"floats_in_water":true}`
- 1 L of steel (7850 kg/m³): inputs `{"density_kg_m3":7850,"volume_m3":0.001}` → `{"solved_for":"mass_kg","mass_kg":7.85,"mass_g":7850,"floats_in_water":false}`

```
GET https://tttkmbb.com/api/v1/calculate/density-mass-volume?mass_kg=2&volume_m3=0.0025
```

## Limitations

The substance is a gas whose density depends strongly on pressure and temperature (use ideal-gas-law), or you need the volume of a shape first (use sphere, cylinder or rectangular-prism). All values are computed from the formula above; no measurement or live data is involved.

## FAQ

**How do I enter volume in litres or cm³?**

Convert to m³ first: litres ÷ 1000, cm³ ÷ 1,000,000. The outputs report the volume in L and cm³ as well.

**Is specific gravity the same as density in g/cm³?**

Numerically almost: specific gravity is density divided by that of water (about 1000 kg/m³ at 4 °C), so it is dimensionless while g/cm³ has units.

## Related

- [Pressure Calculator](https://tttkmbb.com/physics/pressure-force-area.md) — Force and pressure exerted by a mass.
- [Sphere Calculator](https://tttkmbb.com/geometry/sphere.md) — Volume of a sphere for the density formula.
- [Cylinder Calculator](https://tttkmbb.com/geometry/cylinder.md) — Volume of a cylinder for the density formula.
