The Ideal Gas Density Formula

The relationship between pressure, temperature, and density for an ideal gas derives from rearranging the standard ideal gas equation. Instead of working with specific volume, we express the formula in terms of density directly.

ρ = (M × P) / (R_u × T)

  • ρ — Density of the gas (kg/m³)
  • M — Molar mass of the substance (g/mol)
  • P — Absolute pressure of the gas (Pa or bar)
  • R_u — Universal gas constant, 8.314 J/(mol·K)
  • T — Absolute temperature in kelvin (K)

Deriving Density from the Ideal Gas Law

The ideal gas law states that P·ν = R·T, where ν is specific volume—the space occupied per unit mass. Specific volume and density are reciprocals: ν = 1/ρ. Substituting this relationship yields the density formula shown above.

Key insight: density is directly proportional to pressure but inversely proportional to temperature. Double the pressure at constant temperature, and density doubles. Double the absolute temperature at constant pressure, and density halves. This explains why aircraft require different procedures for high-altitude (low-density) flight.

The molar mass term is crucial. Two gases at identical pressure and temperature occupy the same volume per mole, but their densities differ by their molar mass ratio. Oxygen (M ≈ 32 g/mol) is roughly twice as dense as methane (M ≈ 16 g/mol) under identical conditions.

Practical Example: Air Density at Sea Level

Standard air at sea level (15 °C, 101,325 Pa) has well-documented properties. With a molar mass of 28.97 g/mol and using R_u = 8.314 J/(mol·K):

  • Temperature: 15 °C = 288.15 K
  • Pressure: 101,325 Pa (one standard atmosphere)
  • Calculated density: ρ = (28.97 × 101,325) / (8.314 × 288.15) ≈ 1.225 kg/m³

This matches measured values precisely. At higher altitudes where pressure drops to 50 kPa and temperature falls to −30 °C (243 K), air density becomes roughly 0.41 kg/m³—about one-third sea-level value. This is why aerofoil designs must change for high-altitude aircraft.

Critical Considerations When Using This Calculator

The ideal gas law assumption breaks down under certain conditions; understanding these limits prevents calculation errors.

  1. Absolute Pressure Required — Always input absolute pressure, not gauge pressure. A gauge reading of 50 kPa (50 kPa above atmospheric) means actual absolute pressure is roughly 150 kPa. Using gauge pressure introduces a 25–50% error in density calculations.
  2. Temperature Must Be in Kelvin — Converting from Celsius or Fahrenheit to Kelvin is non-negotiable. A 1 K error at room temperature (300 K) introduces 0.3% error; the same 1 K error near −100 °C causes 1.5% error. Always add 273.15 to Celsius values.
  3. Real Gases Deviate from Ideality — The ideal gas model fails near critical points. CO₂ near 31 °C and 7.39 MPa exhibits severe non-ideal behaviour. Similarly, steam near saturation deviates drastically from the formula. For engineering applications, use compressibility factor corrections or real gas equations of state instead.
  4. Molar Mass Variability — Ensure your molar mass matches your gas composition. Air is roughly 78% nitrogen (28 g/mol) and 21% oxygen (32 g/mol), averaging 28.97 g/mol—not round numbers. Pure O₂ or N₂ calculations require their specific values; mixtures need weighted averages.

When Do Real Gases Diverge from the Ideal Model?

No actual gas behaves perfectly ideally. The ideal gas law assumes negligible molecular volume and zero intermolecular forces—assumptions valid only at low pressures and high temperatures relative to a gas's critical point.

Steam (water vapour): Below 10 kPa absolute pressure, steam approximates ideal behaviour regardless of temperature. At atmospheric pressure (101 kPa), especially near the saturation curve, errors exceed 50%. Near the critical point (22.064 MPa, 373.95 K), the model fails completely.

Carbon dioxide: CO₂ remains nearly ideal when reduced pressure and temperature (ratios versus critical values) are low. Above 3–4 MPa or within 20 °C of its 31.05 °C critical temperature, real gas corrections become essential.

For quantifying deviation, engineers use the compressibility factor Z = P·V_m / (R·T), where V_m is molar volume. Z = 1 indicates perfect ideality; Z = 0.8–0.9 signals significant deviation requiring equation-of-state models like the Virial or Peng–Robinson equations.

Frequently Asked Questions

Why does the density formula depend on molar mass when all gases occupy the same volume per mole?

Avogadro's law confirms that equal volumes at the same pressure and temperature contain equal numbers of molecules. However, density measures mass per unit volume, not molecule count. A mole of helium (4 g) and a mole of xenon (131 g) both occupy ~22.4 L at STP, but xenon's density is roughly 33 times higher because its atoms are much heavier. Molar mass directly determines how much mass each mole contributes to a given volume.

What is the difference between absolute and gauge pressure in gas density calculations?

Absolute pressure is measured from zero (perfect vacuum), while gauge pressure is the excess above atmospheric. A tyre reading of 200 kPa gauge pressure actually contains ~300 kPa absolute (200 + 101.3). Using gauge pressure in the density formula dramatically underestimates the result. For a car tyre at 300 kPa absolute versus 200 kPa gauge incorrectly entered, the error is roughly 33%—critical for precise engineering work.

How does altitude affect the accuracy of the ideal gas law for air density?

The ideal gas law remains surprisingly accurate for air even at high altitude because air's pressure and temperature stay relatively far from air's critical point (not reached even in the upper atmosphere). However, moisture content complicates matters. Humid air has a slightly lower effective molar mass (~28.8 g/mol) than dry air (28.97 g/mol), introducing ~0.2% density change per 50% relative humidity. For most applications, dry air assumptions suffice; meteorology and HVAC design often require humidity corrections.

Can this calculator determine whether a gas is behaving ideally under given conditions?

Not directly, but you can cross-check using compressibility factor charts. If you know your gas's critical pressure and temperature, calculate the reduced values (P_r and T_r as fractions of critical). Look up the compressibility factor Z on a generalized chart. If Z is 0.95–1.05, ideal gas assumptions introduce <5% error and are acceptable. If Z < 0.9 or > 1.1, use real gas equations (Virial, Peng–Robinson) for accuracy in engineering calculations.

Why is hydrogen so much less dense than heavier gases like butane?

Density = (Molar mass × Pressure) / (Gas constant × Temperature). Hydrogen has a molar mass of just 2 g/mol compared to butane's 58 g/mol—a 29-fold difference. At identical pressure and temperature, hydrogen's density is therefore 29 times lower than butane's. This extreme density difference is why hydrogen balloons rise in air (density ~0.08 kg/m³ vs air ~1.2 kg/m³) while butane, slightly denser than air at room temperature, sinks. Real-world tank storage exploits this: hydrogen requires lighter, more compact vessels.

How does pressure affect gas density more than temperature does?

Both pressure and temperature appear in the density formula, but their effects differ. Density is directly proportional to pressure (double pressure → double density) yet inversely proportional to absolute temperature (double temperature → half density). In practice, pressure changes are often more dramatic. A pressure increase from 1 bar to 200 bar (a 200× change) is common in industrial equipment, whereas temperatures rarely vary by more than 3–5×. Additionally, pressure is easier to control precisely in engineering systems, making it the dominant practical lever for managing gas density.

More physics calculators (see all)