Understanding the ideal gas law calculator — concept and principle
The ideal gas law links the pressure, volume, temperature and amount of a gas in one equation. Enter pressure, volume and temperature, and the calculator returns the moles, the number of molecules and the mass the gas would have if it were dry air. It is used in chemistry labs and for quick engineering checks.
How it is calculated
- Moles: n = PV / (RT), with R = 8.314462618 J/(mol·K).
- Molecules: N = n × N_A, with the Avogadro constant N_A = 6.02214076 × 10²³ mol⁻¹.
- Mass of air: m = n × M, with an average molar mass of dry air M = 28.97 g/mol.
Pressure is in kPa and volume in litres. Because 1 kPa × 1 L = 1 Pa·m³ = 1 J, the product PV comes out directly in joules and matches the units of R. Temperature is entered in °C and converted to kelvin by adding 273.15.
The principle
In an ideal gas the molecules are treated as points that do not attract each other and only collide elastically. Kinetic theory then shows that the pressure on a wall is proportional to the number of molecules per unit volume and to their average kinetic energy, which is itself proportional to the absolute temperature. Combining Boyle's law (PV constant at fixed T), Charles's law (V proportional to T at fixed P) and Avogadro's law (V proportional to n) gives PV = nRT. Since 2019 R is an exact constant, the product of the Boltzmann and Avogadro constants.
Worked example
- Inputs: P = 101.325 kPa, V = 22.414 L, T = 0 °C.
- Absolute temperature: T = 0 + 273.15 = 273.15 K.
- PV = 101.325 × 22.414 = 2271.10 J; RT = 8.314462618 × 273.15 = 2271.10 J.
- n = 2271.10 / 2271.10 = 1.000001359 mol.
- Molecules: 1.000001359 × 6.02214076 × 10²³ = 6.022149 × 10²³.
- Mass of air: 1.000001359 × 28.97 = 28.97003936 g.
| Volume (L) | Moles n |
|---|---|
| 5.6 | 0.2500003397 |
| 11.2 | 0.5000006794 |
| 16.8 | 0.7500010191 |
| 22.4 | 1.000001359 |
| 28 | 1.250001698 |
| 33.6 | 1.500002038 |
| 44.8 | 2.000002718 |
How to read the result
The default inputs reproduce the classic molar volume: one mole of an ideal gas at 0 °C and 101.325 kPa fills about 22.414 L. Note that IUPAC's current standard pressure is 100 kPa, at which the molar volume at 0 °C is about 22.711 L, so always check which "standard conditions" a textbook uses. For gases other than air, multiply n by their own molar mass.
Common mistakes
- Using °C instead of kelvin in your own hand calculations; at 0 °C that would divide by zero.
- Mixing gauge pressure (as read on a tyre gauge) with absolute pressure; add atmospheric pressure first.
Frequently asked questions
What value of R should I use with atm and litres?
R = 0.082057 L·atm/(mol·K). With kPa and litres use 8.314 L·kPa/(mol·K), which is the same number as J/(mol·K).
Does the ideal gas law depend on which gas it is?
No. For an ideal gas only the number of moles matters, not the type of molecule. The identity of the gas enters only when you convert moles to mass.
Sources: BIPM, The International System of Units (SI Brochure), 9th edition, 2019 · P. Atkins and J. de Paula, Atkins' Physical Chemistry, Oxford University Press · IUPAC, Compendium of Chemical Terminology (Gold Book), entry "standard conditions for gases"