Ideal gas law
Solve PV = nRT for the amount, mass and density of a gas at any pressure and temperature. Absolute units are enforced internally, which is where most hand calculations go wrong.
| Gas | Molar mass | Density (kg/m³) | Specific volume (m³/kg) |
|---|---|---|---|
| Air | 28.970 g/mol | 1.2043 | 0.8303 |
| Nitrogen | 28.013 g/mol | 1.1645 | 0.8587 |
| Oxygen | 31.999 g/mol | 1.3302 | 0.7517 |
| Carbon dioxide | 44.010 g/mol | 1.8295 | 0.5466 |
| Helium | 4.003 g/mol | 0.1664 | 6.0093 |
| Hydrogen | 2.016 g/mol | 0.0838 | 11.9321 |
| Methane | 16.043 g/mol | 0.6669 | 1.4994 |
| Argon | 39.948 g/mol | 1.6607 | 0.6022 |
Density is proportional to molar mass at fixed pressure and temperature — helium is about seven times lighter than air.
PV = nRT · absolute pressure and temperature only
n = PV/(RT) · P in Pa, V in m³, T in K
ρ = PM/(RT) · the form used for gas sizing
m = nM · M in g/mol gives grams
A clear path from inputs to results.
PV = nRT relates pressure, volume, temperature and amount for an ideal gas. It is exact enough for air and combustion products at ordinary conditions, and it is the fastest way to get from a vessel size to a mass of gas. The only rule that matters is that pressure and temperature must be absolute.
How to use
- Enter the absolute pressure in kilopascals.
- Enter the volume in cubic metres.
- Enter the temperature in degrees Celsius; the engine converts to kelvin.
- Select the gas to set its molar mass.
- Read the moles, mass, density and specific volume.
- Compare densities across gases in the table — the ratio is just the molar mass ratio.
The formula
Reference: ISO 80000-5; CODATA 2018 value of the molar gas constant.
Worked example
1 m³ of air at 101.325 kPa and 20 °C (default inputs)
- Pressure 101.325 kPa absolute.
- Volume 1 m³.
- Temperature 20 °C.
- Gas: air, M = 28.97 g/mol.
- 1
Convert to absolute units: 101,325 Pa and 293.15 K.
- 2
Moles: (101,325 × 1) / (8.3145 × 293.15) = 41.57 mol.
- 3
Mass: 41.57 × 28.97 = 1,204.3 g = 1.204 kg.
- 4
Density: 1.204 kg/m³; specific volume 0.830 m³/kg.
41.57 mol · 1.204 kg · 1.204 kg/m³ · 0.830 m³/kg.
Interpreting the result
At standard conditions (0 °C, 101.325 kPa) a mole occupies 22.414 L. At 20 °C it occupies 24.05 L — a 7% difference that matters in ventilation and combustion air calculations. Density is proportional to molar mass at fixed conditions, which is why helium lifts and carbon dioxide settles.
Assumptions & limitations
- The gas is ideal: no intermolecular forces and negligible molecular volume.
- Absolute pressure and absolute temperature are used throughout; gauge pressure must have atmospheric added.
- The gas is pure and its molar mass is known. Mixtures need a mole-weighted molar mass.
- No phase change occurs. Near saturation, the ideal law fails badly.
- Compressibility factor Z = 1. Real gases deviate above about 10 bar or near the critical point.
Frequently asked questions
Why must I use absolute pressure?
Because the law is derived from kinetic theory with a zero at vacuum. Using gauge pressure omits the 101.325 kPa of atmosphere already acting on the gas, which understates the amount by about 15% at low gauge pressures.
When does the ideal gas law break down?
At high pressure, low temperature, or near the critical point — anywhere the molecules are close enough to interact. Use a compressibility factor Z or a cubic equation of state such as Peng-Robinson there.
Does this work for steam?
Only far from saturation. Steam near its dew point behaves very non-ideally, and steam tables or the IAPWS formulation are the right tool.
What is the difference between STP and NTP?
STP is 0 °C and 101.325 kPa (22.414 L/mol); NTP is 20 °C and 101.325 kPa (24.05 L/mol). Some standards use 15 °C. Always confirm which one a specification means.
How do I handle a gas mixture?
Compute a mole-weighted molar mass and use it in the same equations. Dalton’s law lets you sum partial pressures if you prefer to work per component.
How do I get mass flow from volumetric flow?
Multiply volumetric flow by density at the operating conditions. This is why the density readout matters more than the moles for HVAC and process work.
Methodology last reviewed 2026-10-18. Results are informational and not financial or engineering advice — see our disclaimer.