Gas Density Calculator
The density of an ideal gas can be calculated from the ideal gas law using rho = PM/(RT), where P is the absolute pressure (Pa), M is the molar mass of the gas (kg/mol), R is the universal gas constant (8.31446 J/(mol K)), and T is the absolute temperature (K). This formula is derived directly from PV = nRT by substituting n = mass/M and rho = mass/V. It is used in combustion engineering, aerodynamics, HVAC, and atmospheric science. For dry air at 20 degrees C and 1 atm: rho = 101,325 x 0.028964 / (8.31446 x 293.15) = 1.204 kg/m^3.
Ideal gas density formula
rho = P × M / (R × T)
P is pressure in Pascals (Pa), M is molar mass in kg/mol, R = 8.31446 J/(mol K) (NIST value of universal gas constant), T is temperature in Kelvin. Specific volume v = 1/rho = RT/(PM).
Common gas densities at standard conditions (20 C, 1 atm)
- Dry air: 1.204 kg/m^3 (M = 0.028964 kg/mol)
- Nitrogen (N2): 1.165 kg/m^3
- Oxygen (O2): 1.331 kg/m^3
- Carbon dioxide (CO2): 1.830 kg/m^3
- Methane (CH4): 0.668 kg/m^3
- Hydrogen (H2): 0.084 kg/m^3
Frequently asked questions
What is the ideal gas density formula?
From the ideal gas law PV = nRT, the mass density rho = PM/(RT), where P is pressure (Pa), M is molar mass (kg/mol), R is the universal gas constant (8.314 J/(mol K)), and T is absolute temperature (K).
What is the molar mass of common gases?
Air (dry): 0.028964 kg/mol (28.964 g/mol). Nitrogen (N2): 0.028014 kg/mol. Oxygen (O2): 0.031999 kg/mol. Carbon dioxide (CO2): 0.044009 kg/mol. Methane (CH4): 0.016043 kg/mol. These values are from the NIST Chemistry WebBook.
What are standard conditions?
NIST standard conditions: T = 293.15 K (20 degrees C), P = 101,325 Pa (1 atm). STP (IUPAC): T = 273.15 K (0 degrees C), P = 100,000 Pa (1 bar). At NIST standard conditions, dry air density is about 1.204 kg/m^3.
How accurate is this for real gases?
For air and most common gases at near-ambient conditions, the ideal gas law gives density accurate to within about 0.1%. At higher pressures or near the saturation point, use NIST WebBook compressibility data for more accurate results.
Why does gas density decrease at higher altitude?
At higher altitude, atmospheric pressure P decreases. Since rho = PM/(RT), density decreases proportionally. Temperature also decreases with altitude, partially counteracting the pressure effect. The standard atmosphere models both effects.
Official sources
- NIST CODATA: Universal Gas Constant R (NIST).
- NIST Chemistry WebBook: Thermophysical Properties of Fluid Systems.
Reviewed by the CalculatorHub team, edited by James Graham, 15 June 2026. See our methodology.