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.
Molar Masses of Common Gases
Molar mass (g/mol) is the M input of the ideal gas law \(\rho = \frac{P M}{R T}\). The last two columns give each gas's ideal-gas density at 0 °C (273.15 K) and 101325 Pa (1 atm). Here the units are kg/m³, and the numerical value is the same in g/L. Values are rounded, and real gases deviate slightly from ideal behaviour.
| Gas | Formula | Molar mass (g/mol) | Density at 0 °C, 101325 Pa (kg/m³ = g/L) |
|---|---|---|---|
| Hydrogen | H2 | 2.016 | 0.0899 |
| Helium | He | 4.003 | 0.1786 |
| Methane | CH4 | 16.04 | 0.7156 |
| Ammonia | NH3 | 17.03 | 0.7598 |
| Nitrogen | N2 | 28.014 | 1.2498 |
| Air (dry) | mixture | 28.96 | 1.2920 |
| Oxygen | O2 | 31.998 | 1.4276 |
| Argon | Ar | 39.948 | 1.7823 |
| Carbon dioxide | CO2 | 44.01 | 1.9635 |
| Sulfur dioxide | SO2 | 64.07 | 2.8585 |
| Chlorine | Cl2 | 70.90 | 3.1632 |
At these conditions, \(\frac{P}{R T} \approx 44.615\) mol/m³ (a molar volume of about 22.414 L/mol). Density in kg/m³ is therefore about \(0.044615 \times M\), with M in g/mol.
Pressure and Temperature Unit Conversions
The calculator's formula uses pressure in pascals (Pa) and temperature in kelvin (K). Convert other units first.
Pressure to pascals
| Unit | Equivalent in Pa |
|---|---|
| 1 atm | 101325 Pa (exact) |
| 1 bar | 100000 Pa (exact) |
| 1 kPa | 1000 Pa |
| 1 psi | ≈ 6894.76 Pa |
| 1 mmHg (torr) | ≈ 133.322 Pa |
Temperature to kelvin
- From Celsius: \(K = {}^\circ C + 273.15\)
- From Fahrenheit: \(K = ({}^\circ F - 32) \times \frac{5}{9} + 273.15\)
| Celsius | Fahrenheit | Kelvin |
|---|---|---|
| 0 °C | 32 °F | 273.15 K |
| 20 °C | 68 °F | 293.15 K |
| 25 °C | 77 °F | 298.15 K |
| 100 °C | 212 °F | 373.15 K |
Example: 68 °F gives \((68 - 32) \times \frac{5}{9} + 273.15 = 20 + 273.15 = 293.15\) K.
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.