Ideal Gas Density Calculator

Calculate gas density from pressure, temperature, and molar mass using the ideal gas law ρ = PM / (RT), for air or any custom gas.

Quick Facts

Density formula
ρ = PM / (RT)
Derived from the ideal gas law PV = nRT with n = m/M and ρ = m/V.
Universal gas constant
R = 8.314462618 J/(mol·K)
Used with pressure in pascals, molar mass in kg/mol, and temperature in kelvin.
Reference point
Dry air ≈ 1.204 kg/m³
At 20°C and 1 atm — a common comparison baseline.

Your Results

Calculated
Gas Density
-
ρ = PM / (RT), in kg/m³
Density (Imperial)
-
Converted to lb/ft³
Molar Volume
-
Vm = RT / P, in L/mol
Specific Gas Constant
-
R_specific = R / M, in J/(kg·K)

Ready

Enter gas conditions and press Calculate.

Formula and Method for Ideal Gas Density

The ideal gas law, PV = nRT, relates a gas's pressure (P), volume (V), amount of substance (n, in moles), and absolute temperature (T) through the universal gas constant R = 8.314462618 J/(mol·K). Density is mass per volume, ρ = m/V, and the number of moles equals mass divided by molar mass, n = m/M. Substituting n = m/M into PV = nRT and rearranging gives m/V = PM/(RT), so ρ = PM / (RT) — gas density depends only on pressure, molar mass, and absolute temperature, not on how much gas is present.

How the calculation works

Enter the gas pressure and its unit (converted internally to pascals), the temperature and its unit (converted internally to kelvin — absolute zero is 0 K, or −273.15°C), and the molar mass in grams per mole (pick a common gas from the dropdown or enter a custom value). The calculator converts pressure to Pa, temperature to K, and molar mass to kg/mol, then applies ρ = PM/(RT) to get density in kg/m³, with an lb/ft³ conversion alongside it. It also reports the molar volume, Vm = RT/P (the volume one mole of gas occupies under these conditions), and the specific gas constant, R_specific = R/M, which is useful for further thermodynamic work with that particular gas.

When the ideal gas approximation holds

The ideal gas law is accurate — typically within 1-2% — for most gases at pressures near atmospheric or below and temperatures well above their boiling point, where molecules are far apart and intermolecular forces are negligible. It becomes less reliable at very high pressure, very low temperature (near condensation), or for gases with strong intermolecular attraction such as water vapor or ammonia; in those cases a real-gas equation of state (for example, van der Waals) gives a better estimate.

Common mistakes

  • Using Celsius or Fahrenheit directly: the ideal gas law requires absolute temperature in Kelvin; plugging in °C or °F without converting produces incorrect, sometimes negative, density values.
  • Mixing up molar mass units: molar mass must be converted to kg/mol to stay consistent with R = 8.314 J/(mol·K); this calculator handles that conversion from the g/mol value you enter.
  • Assuming gas density is constant: unlike liquids and solids, gas density changes significantly with conditions — doubling absolute pressure roughly doubles density, while doubling absolute temperature roughly halves it.

Real-world applications

  • HVAC and combustion engineering use gas density to size ductwork, fans, and burners for the actual operating pressure and temperature, not just standard conditions.
  • Aviation and meteorology use air density to compute lift, engine performance, and pressure-altitude corrections.
  • Chemistry and process engineering use molar volume and density to convert between mass and volume flow rates for a gas stream.
  • Buoyancy and balloon calculations compare a lifting gas's density (such as helium or hydrogen) against that of surrounding air.

Frequently Asked Questions

What is the formula for ideal gas density?
Gas density is ρ = PM / (RT), where P is absolute pressure, M is molar mass, R is the universal gas constant (8.314462618 J/(mol·K)), and T is absolute temperature in Kelvin. This comes from combining the ideal gas law PV = nRT with n = m/M and ρ = m/V.
Why must temperature be in Kelvin for this calculation?
The ideal gas law only holds for absolute temperature, where 0 K represents zero molecular kinetic energy. Using °C or °F directly (which can be zero or negative at temperatures gases exist at) breaks the proportionality and produces incorrect results, so this calculator converts any input unit to Kelvin before computing.
How accurate is the ideal gas law for real gases?
It is very accurate for most gases near atmospheric pressure and at temperatures well above their boiling point, typically within 1-2% of measured density. Accuracy drops at high pressure, low temperature, or for gases with strong intermolecular attraction (such as water vapor or ammonia), where a real-gas equation of state gives a better estimate.
What is the density of air at standard conditions?
Using dry air's average molar mass of 28.97 g/mol, ρ = PM/(RT) gives about 1.204 kg/m³ at 20°C and 1 atm, and about 1.225 kg/m³ at 15°C and 1 atm (the ISA sea-level standard). Density falls as temperature rises or altitude (and thus pressure) increases.