What Is the Gas Density Calculator?
This tool computes the density of an ideal gas from three measurable quantities: absolute pressure, molar mass, and absolute temperature. It is based on the rearranged ideal gas law and works for any gas — air, nitrogen, carbon dioxide, methane, and more. Results are reported in kilograms per cubic metre (kg/m³), which is numerically identical to grams per litre (g/L).
How to Use It
Enter the pressure in pascals (Pa), the molar mass in grams per mole (g/mol), and the temperature in kelvin (K). For example, standard atmospheric pressure is 101325 Pa, dry air has a molar mass of about 28.96 g/mol, and 0 °C equals 273.15 K. Press calculate to obtain the density. To convert from °C to K, add 273.15; to convert atm to Pa, multiply by 101325.
The Formula Explained
Starting from \(PV = nRT\) and noting that \(n = \text{mass}/M\) and density \(\rho = \text{mass}/V\), the equation rearranges to $$\rho = \frac{PM}{RT}.$$ Here \(R = 8.314462618\ \text{J/(mol}\cdot\text{K)}\). Because \(R\) uses SI units, the molar mass must be in kg/mol, so the calculator divides your g/mol input by 1000 internally. Density rises with pressure and molar mass, and falls as temperature increases.
Worked Example
For dry air at standard conditions: \(P = 101325\ \text{Pa}\), \(M = 28.96\ \text{g/mol} = 0.02896\ \text{kg/mol}\), \(T = 273.15\ \text{K}\). Then $$\rho = \frac{101325 \times 0.02896}{8.314462618 \times 273.15} \approx \frac{2934.37}{2271.10} \approx 1.292\ \text{kg/m}^3$$ — matching the well-known density of air at 0 °C.
FAQ
Does kg/m³ equal g/L? Yes. 1 kg/m³ = 1 g/L exactly, so the two outputs share the same number.
Why must temperature be in kelvin? The ideal gas law uses absolute temperature; using °C would give wrong (even negative) densities.
Is this accurate for real gases? It is an excellent approximation at moderate pressures and temperatures. Near condensation or very high pressure, real-gas corrections (compressibility factor \(Z\)) are needed.