Enter the pressure, temperature, and the molar mass into the calculator to determine the density of a gas.

Gas Density Calculator

Enter any 3 values to calculate the missing variable





Gas Density Formula

The gas density calculator uses the ideal gas relationship to connect density, pressure, temperature, and molar mass. It is a practical tool for chemistry, HVAC, process engineering, combustion analysis, and any application where you need the mass of a gas per unit volume.

\rho = \frac{P M}{R T}

Where:

  • ρ = gas density
  • P = absolute pressure
  • M = molar mass of the gas
  • R = universal gas constant in a unit system consistent with the inputs
  • T = absolute temperature

This relationship shows three core trends: density increases with pressure, density decreases as temperature rises, and heavier gases have greater density than lighter gases at the same pressure and temperature.

How to Use the Gas Density Calculator

  1. Enter any three known values: pressure, molar mass, temperature, or density.
  2. Use absolute pressure. If you have gauge pressure, convert it to absolute pressure before solving by hand.
  3. Use an absolute temperature scale. Kelvin is required for direct use of the formula.
  4. Keep units consistent throughout the calculation.
  5. Calculate the missing value and compare the result with the expected behavior of the gas.

Rearranged Forms

If you need to solve for a different variable, the same equation can be rearranged as follows:

P = \frac{\rho R T}{M}
M = \frac{\rho R T}{P}
T = \frac{P M}{\rho R}

These forms are useful when checking required operating pressure, estimating an unknown gas from test data, or studying how density changes with temperature.

Unit Guidance

The gas constant depends on the units you choose. Two common combinations are:

  • atm, g/mol, K, g/L: use 0.082057 L·atm/(mol·K)
  • Pa, kg/mol, K, kg/m³: use 8.314462618 J/(mol·K)

For gas density, g/L and kg/m³ are numerically equivalent, which makes those two units easy to compare.

Common Molar Mass Values

Gas Molar Mass
Hydrogen 2.016 g/mol
Helium 4.003 g/mol
Methane 16.04 g/mol
Nitrogen 28.01 g/mol
Dry Air 28.97 g/mol
Oxygen 32.00 g/mol
Carbon Dioxide 44.01 g/mol

Example Calculation

For dry air at 1 atm and 300 K, using a molar mass of 28.97 g/mol:

\rho = \frac{(1)(28.97)}{(0.082057)(300)}
\rho \approx 1.18 \text{ g/L}

This value is also 1.18 kg/m³.

What Affects Gas Density Most?

  • Pressure changes: doubling absolute pressure approximately doubles density if temperature stays the same.
  • Temperature changes: heating a gas expands it and lowers density if pressure stays the same.
  • Gas composition: gases with larger molar mass produce higher density under identical conditions.

When the Ideal Gas Formula Is Less Accurate

The standard gas density equation works well for many everyday calculations, but accuracy can decrease at very high pressure, very low temperature, near condensation, or for strongly non-ideal gases. In those cases, a compressibility factor may be included:

\rho = \frac{P M}{Z R T}

Here, Z is the compressibility factor. When Z is close to 1, the ideal gas form is usually a good approximation.

Practical Uses of Gas Density

  • Airflow and ventilation calculations
  • Fuel gas and combustion analysis
  • Purge and pressurization system sizing
  • Buoyancy and lift estimates
  • Pipeline, storage, and vessel calculations
  • Environmental and laboratory gas measurements