Ideal Gas Density Calculator
Written by Thierno Sadou Diallo, formula verified per our methodology • Last checked on 9/9/2026
An ideal gas's density is calculated with ρ = (P × M) ÷ (R × T), where P is the pressure, M the gas's molar mass, R the universal gas constant, and T the absolute temperature. Under standard conditions (0°C, 101.325 kPa), air (average molar mass 28.97 g/mol) has a density of about 1.29 kg/m³ — a well-known, independently verifiable value.
Explanation
This formula is derived directly from the ideal gas law, PV = nRT: replacing the number of moles n with the ratio mass ÷ molar mass (n = m ÷ M), the equation becomes PM = (m ÷ V) × RT, or PM = ρRT once you recognize that mass divided by volume is exactly the density ρ. This calculator therefore lets you find a gas's density without ever needing to know its volume directly, from three easily measured or tabulated quantities. The formula also reveals why certain everyday phenomena occur: a balloon filled with helium (molar mass about 4 g/mol) floats in air (average molar mass about 29 g/mol) because, at equal pressure and temperature, its density is much lower; likewise, the hot air in a hot-air balloon is less dense than the surrounding cold air, since density is inversely proportional to absolute temperature at constant pressure and molar mass — this is what lets the balloon rise. This formula remains an approximation, valid as long as the gas behaves like an ideal gas: it loses accuracy at very high pressure or low temperature, as the gas approaches liquefaction, exactly the same limits that apply to Boyle's law.
Example: air under standard conditions (0°C, 101.325 kPa)
Inputs
Pressure: 101.325 kPa. Molar mass: 28.97 g/mol (air). Temperature: 273.15 K (0°C).
Calculation
ρ = (101.325 × 28.97) ÷ (8.314462618 × 273.15) ≈ 2,936.39 ÷ 2,271.11 ≈ 1.2925 kg/m³.
Result
Air's density under these conditions is about 1.29 kg/m³.
Frequently asked questions
Why is hot air less dense than cold air?
According to the formula, density is inversely proportional to absolute temperature, at constant pressure and molar mass: as temperature rises, density falls. This is the principle that lets a hot-air balloon rise — the air heated inside the envelope becomes less dense than the surrounding cold air, creating a net lifting force.
Why does a helium-filled balloon float in air?
Because helium's molar mass (about 4 g/mol) is much lower than air's average molar mass (about 29 g/mol): at equal pressure and temperature, helium is therefore about 7 times less dense than air, which generates enough buoyancy to make a balloon filled with this gas float.
Is this formula valid at any pressure?
No, it rests on the ideal gas approximation, valid for most common gases at moderate pressure and not-too-low temperature. It becomes less accurate at very high pressure or as the gas approaches its liquefaction temperature, where interactions between molecules (ignored by this model) become significant.