Gas Density Calculator

Calculate the density of any gas from its pressure, absolute temperature, and molar mass using the ideal gas law ρ = PM / RT, plus its specific gravity relative to air and molar volume.

Quick Facts

Ideal gas law
ρ = PM / RT
Density equals pressure times molar mass, divided by the gas constant times absolute temperature.
Gas constant (R)
8.314 J/(mol·K)
Used with SI units: pressure in pascals, temperature in kelvin, molar mass in kg/mol.
Air's molar mass
≈ 28.97 g/mol
The reference value used to compute a gas's specific gravity (vapor density) relative to air.

Your Results

Calculated
Gas Density
-
ρ = PM / RT, in kg/m³
Density (lb/ft³)
-
Same density converted to imperial units
Specific Gravity (vs. Air)
-
M_gas / M_air (28.97 g/mol)
Molar Volume
-
V_m = RT / P, in L/mol

Ready

Enter pressure, temperature, and molar mass, then press Calculate.

How to Use the Gas Density Calculator

Unlike liquids and solids, a gas has no fixed density — how tightly its molecules are packed depends directly on pressure and temperature. This calculator uses the ideal gas law to compute density, specific gravity relative to air, and molar volume from three inputs: the gas's molar mass, its absolute pressure, and its absolute temperature.

Deriving density from the ideal gas law

The ideal gas law states PV = nRT, where P is absolute pressure, V is volume, n is the number of moles, R is the universal gas constant (8.314 J/(mol·K), equivalently Pa·m³/(mol·K)), and T is absolute temperature. Since the number of moles n equals mass m divided by molar mass M, substituting n = m/M gives PV = (m/M)RT. Rearranging for density (ρ = m/V) yields the working formula: ρ = PM / (RT). Plug in air's molar mass (28.97 g/mol = 0.02897 kg/mol) at 1 atm (101,325 Pa) and 25°C (298.15 K) and you get ρ = (101325 × 0.02897) / (8.314 × 298.15) ≈ 1.184 kg/m³, matching the standard reference value for air at room temperature.

Picking correct units and the gas constant

Temperature must always be converted to Kelvin (K = °C + 273.15, or K = (°F − 32) × 5/9 + 273.15) — the ideal gas law only works with absolute temperature, and plugging in Celsius or Fahrenheit directly gives meaningless results. This calculator converts your pressure input (atm, kPa, Pa, bar, psi, or mmHg) to pascals and your temperature to Kelvin internally, then applies R = 8.314 J/(mol·K) with molar mass converted to kg/mol so the result comes out in kg/m³. Specific gravity (vapor density) compares a gas's molar mass directly to air's 28.97 g/mol, since the pressure and temperature terms cancel out when two gases are compared under the same conditions.

Real-world applications

  • HVAC and ventilation engineers use gas density to size ductwork and calculate airflow mass rates at different altitudes and temperatures.
  • Natural gas and industrial piping calculations use density to convert between volumetric and mass flow rates for billing and safety analysis.
  • Specific gravity relative to air tells safety engineers whether a leaking gas (propane, natural gas, hydrogen) will pool near the floor or rise and disperse.
  • Meteorologists and aviators use air density to calculate lift, engine performance, and "density altitude" for aircraft takeoff planning.

Frequently Asked Questions

What is the formula for gas density?
Gas density comes from the ideal gas law: ρ = PM / (RT), where P is absolute pressure, M is the gas's molar mass, R is the universal gas constant (8.314 J/(mol·K)), and T is absolute temperature in Kelvin. For example, air (M = 28.97 g/mol) at 1 atm and 25°C has a density of about 1.184 kg/m³.
Why must temperature be in Kelvin, not Celsius or Fahrenheit?
The ideal gas law is built on absolute temperature. Using Celsius or Fahrenheit directly in PV = nRT gives the wrong ratio (and can even produce negative or undefined results near 0°C). Always convert to Kelvin first: K = °C + 273.15, or K = (°F − 32) × 5/9 + 273.15.
How is a gas's specific gravity (vapor density) calculated?
Specific gravity of a gas is its molar mass divided by the molar mass of air: SG = M_gas / M_air, using M_air = 28.97 g/mol. Because both gases occupy the same volume at the same pressure and temperature, the pressure and temperature terms cancel, leaving a simple molar-mass ratio. A value above 1 means the gas is denser than air and tends to sink (propane, SG ≈ 1.55); below 1 means it rises (helium, SG ≈ 0.14).
Does gas density change with pressure and temperature?
Yes — unlike liquids and solids, gases are highly compressible. Density is directly proportional to absolute pressure (double the pressure, double the density) and inversely proportional to absolute temperature (double the Kelvin temperature, halve the density), which is why gas density must always be reported alongside the conditions it was measured at.