Gas Density Calculator (Density and Molar Mass)
Calculate how many grams of a gas fit in a litre at your pressure and temperature, or turn a measured density into the molar mass to identify the gas.
Updated
Report a problem
Formula
- Density:
ρ = P × M ÷ (R × T) - Molar mass:
M = ρ × R × T ÷ P - Molar volume:
Vm = R × T ÷ P
R = 8.314462618 J/(mol K). Pressure is converted to pascals (1 atm = 101325 Pa, 1 bar = 100000 Pa, 1 mmHg = 101325 / 760 Pa) and temperature to kelvin (K = °C + 273.15). With M in kg/mol, ρ comes out in kg/m³, which equals g/L.
Worked example
Density of carbon dioxide (M = 44.01 g/mol) at 100 kPa and 300 K:
- P = 100 000 Pa and M = 0.04401 kg/mol.
- ρ = 100 000 × 0.04401 ÷ (8.314462618 × 300) = 4401 ÷ 2494.34
- ρ = 1.764 g/L, which is 1.764 kg/m³.
Frequently asked questions
How do you calculate the density of a gas?
Use ρ = P × M ÷ (R × T), from the ideal gas law. For nitrogen (28.0134 g/mol) at 101325 Pa and 273.15 K: ρ = 101325 × 0.0280134 ÷ (8.314462618 × 273.15) = 1.2498 kg/m³, which is 1.2498 g/L.
How do I find the molar mass of an unknown gas?
Use M = ρ × R × T ÷ P. A gas with density 2.0 g/L at 100 kPa and 300 K has M = 2.0 × 8.314462618 × 300 ÷ 100 000 × 1000 = 49.89 g/mol. Compare that with the molar masses of candidate gases.
What is the density of air?
Taking an average molar mass of 28.96 g/mol, dry air at 1 atm and 25 °C has a density of 101325 × 0.02896 ÷ (8.314462618 × 298.15) = 1.184 g/L. It falls as temperature rises or pressure drops.
Why is g/L the same as kg/m³?
1 kg is 1000 g and 1 m³ is 1000 L, so 1 kg/m³ = 1000 g ÷ 1000 L = 1 g/L. The calculator shows density in g/L and you can read it directly as kg/m³.
How accurate is the ideal gas density?
It is accurate for most gases near room conditions, typically within about 1% at 1 atm. It becomes less reliable at high pressure, low temperature or near the boiling point, where real gases deviate. For example CO2 at 1 atm and 0 °C measures about 1.977 g/L, while the ideal value is 1.964 g/L.