Math & Science
Density calculator icon showing a beaker for mass and volume

Density calculator

A density calculator lets you enter any two of three values — mass, volume, or density — and instantly get the third. It also checks whether a material will float or sink in water, using the same density figure.

Enter any two fields and click “Calculate”. The density calculator works in SI units (kilogram, cubic meter, kg/m³); use the unit menus for grams, liters, cubic centimeters or g/cm³. 1 g/cm³ = 1000 kg/m³ = 1 kg/L.

Enter two known values

Does it float or sink?

Compare the density of a material with that of water (about 1000 kg/m³, which is 1 g/cm³).

How to use the density calculator

The first panel above solves for whichever of mass, volume, or density you’re missing — fill in any two and press Calculate. The second panel is a quick float-or-sink check: enter a material’s density and it tells you how that material behaves compared to water.

What is density?

Density indicates how much mass a given volume of a substance has; its SI unit is the kilogram per cubic meter (kg/m³), built from the SI base units listed by NIST. Specific gravity, or relative density, is a different number: the density divided by the density of water, so it has no unit. A substance with a high density weighs more, for the same volume, than a substance with a low density. As Britannica’s entry on density puts it, density offers a convenient way to get the mass of a body from its volume, or the reverse, once you know the substance’s density.

Density = mass ÷ volume

A worked example: how to calculate density

Say you have a block of material with a mass of 5 kg and a volume of 2 liters (0.002 m³). To calculate density, divide mass by volume: 5 kg ÷ 0.002 m³ = 2500 kg/m³, which is 2.5 g/cm³. Entering mass 5 kg and volume 2 L into the density calculator highlights the density field and returns exactly 2500 kg/m³. The same logic runs in reverse: given a density of 2500 kg/m³ and a mass of 5 kg, the density calculator solves for volume (5 ÷ 2500 = 0.002 m³ = 2 L); given density and volume, it solves for mass (2500 × 0.002 = 5 kg).

Density of common materials

MaterialDensity in g/cm³ (× 1000 = kg/m³)
Air (at room temperature)~0.0012
Gasoline~0.75
Olive oil~0.92
Ice~0.92
Water (at 4°C)1.00
Aluminum~2.70
Iron / steel~7.85 – 7.87
Copper~8.96
Lead~11.34
Gold~19.30

These figures for the density of common materials are standard reference values at or near room temperature; Wikipedia’s entry on density lists the same units (kg/m³, g/cm³, kg/L) and the factor of 1000 between them. Gold, for example, is about 19.3 g/cm³, or 19,300 kg/m³.

Why do some things float and others sink?

An object floats in water if its density is lower than that of water (about 1000 kg/m³, or 1 g/cm³); if the density is higher, the object sinks. This explains, for example, why ice keeps floating on water: frozen water has a slightly lower density (about 917 kg/m³) than liquid water — an unusual property that most other substances don’t have, since they typically become denser when they freeze.

Using the float-or-sink panel of the density calculator with its default value of 920 kg/m³ — about the density of olive oil and of ice — confirms this: 920 is below water’s 1000 kg/m³, so the material floats, with a relative density of 0.92.

Common uses for a density calculator

Identifying an unknown material. Measuring an object’s mass and volume, entering them in the density calculator and comparing the resulting density against a reference table is a quick way to narrow down what it’s made of, especially for metals that look similar.

Checking specific gravity in brewing or winemaking. Hydrometer readings are a form of specific gravity, and tracking how it changes over fermentation tells you how much sugar has converted to alcohol.

Packing and shipping. Freight is often priced by dimensional weight, which depends on density — low-density items can cost more to ship than their actual weight would suggest.

Geology and mineral identification. Specific gravity is one of the standard tests geologists use to tell similar-looking minerals apart, alongside hardness and streak color.

Common mistakes when calculating density

Mixing up mass and weight. Density uses mass, not weight — the two are proportional on Earth but not interchangeable, and the distinction matters if you’re ever comparing measurements taken elsewhere.

Forgetting to convert units. Entering grams into a field expecting kilograms, or milliliters into one expecting liters, silently throws the result off by a factor of 1000 — always check the units labeled on each field.

Assuming density is constant. Most substances expand when heated and contract when cooled, so a density measured at one temperature won’t exactly match a reference value taken at another.

Related calculators

If your volume is in gallons or cubic feet, convert it first with the volume converter, and use the weight converter for pounds or ounces. To turn a mass into a weight force (F = m × g), the force calculator takes over where the density calculator stops.

Frequently asked questions

How do kg/m³, g/cm³ and kg/L relate?

1 g/cm³ equals 1000 kg/m³, because a cubic meter holds 1,000,000 cm³ and a kilogram is 1000 grams. A liter is 1000 cm³, so 1 kg/L is the same as 1 g/cm³. The density calculator converts between them for you.

Does the density of a substance change with temperature?

Yes, most substances expand when heated and contract when cooled, which changes their density accordingly. The density values in the table apply at roughly room temperature, unless stated otherwise.

Can I also use this for gases?

Yes, the formula density = mass ÷ volume also applies to gases, although the density of gases is strongly dependent on temperature and pressure.

Is this density calculator free to use?

Yes, this density calculator is completely free, requires no sign-up, and runs entirely in your browser — none of the numbers you enter are sent anywhere or stored.

This density calculator provides a general, physically correct calculation based on the values you entered. Back to CalcSwiftly home.

Reviewed by: CalcSwiftly · Last reviewed: