Gas Density Calculator – Density of an Ideal Gas ρ = PM/RT

Use this free Gas Density Calculator to find the density of an ideal gas from ρ = PM/(RT). Pick a gas (or enter a custom molar mass), then enter the pressure and temperature — the tool gives the density in kg/m³.

gas at pressure P, temperature T P ↑ → ρ ↑ T ↑ → ρ ↓

Formula

ρ = PM/(RT) — where P is the pressure (Pa), M is the molar mass (kg/mol), R = 8.314 J/(mol·K) is the ideal gas constant and T is the absolute temperature (K). This comes from rearranging the ideal gas law PV = nRT with n = mass/M. Density is directly proportional to pressure and molar mass, and inversely proportional to temperature.

How to use

Worked example

Find the density of air (M = 29 g/mol) at standard pressure 101.325 kPa and 0 °C (273.15 K).
ρ = PM/(RT) = (101,325 × 0.029) / (8.314 × 273.15) = 2938.43 / 2270.97 = 1.29 kg/m³
That matches the textbook density of dry air at 0 °C. (Warm it to 25 °C and the same formula gives a lighter 1.19 kg/m³.)

FAQ

Why does a gas get less dense when heated at the same pressure?
ρ = PM/(RT): temperature sits in the denominator. In an open container the pressure stays fixed, so hotter gas expands — the same mass spreads over a bigger volume and the density falls. That is why hot air rises and balloons float.

Why is carbon dioxide denser than air?
At the same P and T, density is proportional to molar mass. CO₂ has M = 44 g/mol against air's ≈ 29 g/mol, so CO₂ is about 1.5× denser — which is why it pools in low places and pours "downhill" in demonstrations.

When does this formula fail?
It is exact only for an ideal gas. At very high pressures or near the point where the gas liquefies, real gases deviate a little, but for everyday pressures and temperatures the result is accurate to well under 1%.