Gas Density Calculator
Enter the pressure, temperature, and molar mass of any gas to instantly find its density using the ideal gas law. Choose a preset gas to fill in the molar mass automatically, pick your preferred pressure and density units, and flip to reverse-solve mode to find pressure, temperature, or molar mass from a known density. The show-your-work panel traces every step of the algebra.
Formula
Worked example
Dry air (M = 28.97 g/mol) at 25 C and 101325 Pa: rho = (101325 x 0.02897) / (8.314 x 298.15) = 2935.4 / 2478.8 = 1.1844 kg/m3. Specific volume = 1 / 1.1844 = 0.8443 m3/kg. Molar volume = (8.314 x 298.15) / 101325 = 0.02445 m3/mol = 24.45 L/mol.
What is gas density and why does it matter?
Gas density is the mass of a gas per unit volume, expressed in kilograms per cubic metre (kg/m3) or grams per litre (g/L). Unlike liquids and solids, gases are highly compressible, so their density changes significantly with pressure and temperature. This matters in many practical contexts: engineers designing HVAC ducts, gas pipelines, or combustion systems all need accurate density values to compute mass flow rates, pressure drops, and buoyancy effects. Safety assessments for fuel storage also depend on knowing whether a leaking gas will rise (lighter than air, such as hydrogen or methane) or pool at floor level (heavier than air, such as propane or CO2).
The ideal gas law and its limits
This calculator uses the ideal gas law in the form rho = PM/(RT), where P is absolute pressure in pascals, M is the molar mass in kg/mol, R is the universal gas constant (8.314 J/(mol K)), and T is the absolute temperature in Kelvin. The ideal gas law is accurate to within about 1% for most common gases at pressures below 10 bar and temperatures well above the boiling point. At higher pressures or near the liquefaction point, real-gas effects become important: the compressibility factor Z modifies the equation to rho = PM/(ZRT). For most atmospheric and low-pressure engineering work, Z equals 1 and the ideal gas law gives reliable results.
Reverse-solve: find pressure, temperature, or molar mass
Because the ideal gas law relates four quantities, you can solve for any one of them given the other three. Use the "Solve for" selector at the top: choose Pressure to find what pressure is needed to achieve a target density at a known temperature, choose Temperature to find how hot or cold a gas must be to reach a given density, or choose Molar mass to identify an unknown gas from a measured density, pressure, and temperature. The show-your-work panel beneath the result traces the algebra for whichever mode you select.
Unit conversions and how to use this calculator
Pressure can be entered in Pa, kPa, MPa, bar, atm, or psi. Temperature can be in Celsius, Kelvin, or Fahrenheit. Density can be displayed in kg/m3, g/L (numerically equal to kg/m3), or lb/ft3. Always use absolute pressure, not gauge pressure: add your local atmospheric pressure (roughly 101.325 kPa or 14.696 psi at sea level) to any gauge reading before entering it. The ten preset gases auto-fill the molar mass field, or choose Custom to enter your own value for any pure gas or gas mixture (calculate the mixture molar mass as the mole-fraction-weighted average of the component molar masses).
Molar mass and density of common gases at STP (0 C, 101.325 kPa)
| Gas | Formula | Molar mass (g/mol) | Density at STP (kg/m3) | vs. dry air |
|---|---|---|---|---|
| Hydrogen | H2 | 2.016 | 0.0899 | x0.07 - rises fast |
| Helium | He | 4.003 | 0.1785 | x0.15 - rises fast |
| Methane | CH4 | 16.04 | 0.7168 | x0.60 - rises |
| Ammonia | NH3 | 17.03 | 0.7710 | x0.64 - rises |
| Dry air | mix | 28.97 | 1.2922 | x1.00 - reference |
| Nitrogen | N2 | 28.01 | 1.2506 | x0.97 - near air |
| Oxygen | O2 | 32.00 | 1.4290 | x1.11 - sinks |
| Argon | Ar | 39.95 | 1.7839 | x1.38 - sinks |
| Carbon dioxide | CO2 | 44.01 | 1.9768 | x1.53 - sinks |
| Propane | C3H8 | 44.10 | 1.9675 | x1.52 - sinks |
Densities computed from the ideal gas law at standard temperature and pressure (0 C, 1 atm). Values match NIST data for ideal-gas behavior.
Frequently asked questions
What is the density of air at room temperature?
Dry air at 20 C (68 F) and standard atmospheric pressure (101.325 kPa) has a density of about 1.204 kg/m3. At 25 C the value drops to about 1.184 kg/m3. Humidity slightly reduces density because water vapour (M = 18 g/mol) is lighter than dry air (M = 28.97 g/mol).
Why must I use absolute pressure instead of gauge pressure?
The ideal gas law requires the total pressure acting on the gas, which includes the atmospheric contribution. Gauge pressure reads zero at atmospheric pressure, so if your gauge reads 2 bar, the absolute pressure is about 3.013 bar (2 + 1.013). Using gauge pressure directly will understate the density.
Does the formula work for gas mixtures?
Yes. Calculate the effective molar mass of the mixture as the weighted average: M_mix = sum(x_i x M_i) where x_i is the mole fraction of component i. For example, a mixture that is 80% N2 (28.01 g/mol) and 20% O2 (32.00 g/mol) has M_mix = 0.80 x 28.01 + 0.20 x 32.00 = 28.81 g/mol. Enter this value in the Custom molar mass field.
When is the ideal gas law not accurate enough?
The ideal gas law assumes no intermolecular forces and zero molecular volume. These assumptions break down at high pressures (above about 10 bar) or near the critical point or boiling point of the gas. In those cases, use the van der Waals equation or a full equation of state (Peng-Robinson, Soave-Redlich-Kwong) with a compressibility factor Z. For most atmospheric and low-pressure HVAC or ventilation work, the ideal gas law is accurate to better than 1%.
How do I find the density of a gas at standard conditions?
Standard conditions vary by convention. IUPAC standard (STP) uses 0 C and 100 kPa; the older NIST standard uses 0 C and 101.325 kPa; some engineering standards use 15 C and 101.325 kPa. Set the temperature and pressure to your chosen standard and the calculator gives the correct density. At IUPAC STP, one mole of any ideal gas occupies 22.71 L; at 0 C and 1 atm it occupies 22.41 L.
What gases are lighter than air, and which are heavier?
Gases with a molar mass below 28.97 g/mol (dry air) are lighter than air and will rise: hydrogen (2.02), helium (4.00), methane (16.04), and ammonia (17.03) are common examples. Gases heavier than air sink and can accumulate in low-lying areas: propane (44.10), carbon dioxide (44.01), argon (39.95), and oxygen (32.00) all fall into this category. The reference table on this page lists densities for ten common gases at STP.