The ideal gas law is one equation with four variables, which means it is really four useful calculators depending on which one you solve for. Fix any three and the fourth follows.
This simulator fixes amount, volume and temperature and reports pressure, then draws the isotherm so you can see the inverse relationship between pressure and volume at constant temperature — the curve that Boyle’s law describes.
One equation, three useful rearrangements
Solved for pressure it is p = nRT/V, the version used here. Solved for volume it gives the molar volume — 22.4 L at 0 °C and 1 atm, the number every chemistry course quotes. Solved for density it becomes ρ = pM/(RT), which is how gas density tables are generated.
The specific gas constant R_specific = R/M is the form engineers use, because it works in mass units: p = ρR_specific·T. For air that constant is 287 J/kgK, and it appears in everything from compressor work to duct pressure drop.
When the ideal assumption holds
The model assumes molecules have negligible volume and no intermolecular forces. Both assumptions degrade at high pressure and low temperature — precisely the conditions where a gas approaches its saturation line.
A useful rule of thumb: below about 5 bar and above twice the boiling point, errors are usually under a few percent. Near the critical point, or in refrigeration cycles, you need a real-gas equation of state or tabulated properties.
Molar mass and the speed of the molecules
Helium is seven times lighter than air but only about 2.7 times faster in RMS speed, because speed scales with the square root of the mass ratio. That square root is why lighter gases leak faster but not proportionally so.
| Gas | M (g/mol) | Density at 25 °C, 1 atm | v_rms (m/s) |
|---|---|---|---|
| Air | 28.97 | 1.18 kg/m³ | 507 |
| Helium | 4.00 | 0.164 kg/m³ | 1360 |
| Carbon dioxide | 44.01 | 1.80 kg/m³ | 412 |
| Argon | 39.95 | 1.63 kg/m³ | 432 |
| Methane | 16.04 | 0.657 kg/m³ | 681 |
Two traps in gas calculations
The first is temperature units: every gas equation needs absolute temperature. Using 25 instead of 298 K gives a pressure wrong by a factor of twelve, and it is the single most common error in hand calculations.
The second is mixing up mass and moles. A kilogram of helium is 250 mol; a kilogram of carbon dioxide is 22.7 mol — an eleven-fold difference in the amount of substance, and therefore in pressure at the same volume and temperature.
Frequently asked questions
Why does the isotherm curve rather than run straight?
Because pressure is inversely proportional to volume at fixed temperature. Doubling the volume halves the pressure, so the curve is a hyperbola — steep at small volumes, flat at large ones.
Can I use this for steam?
Only as a rough estimate for superheated steam far from saturation. Near the saturation line, steam properties must come from tables or a real-gas formulation; the ideal gas law can be wrong by tens of percent.
What is the RMS speed used for?
It sets the scale of molecular transport: diffusion, viscosity and thermal conductivity of a gas all rise with molecular speed. It also explains why sound travels faster in helium — the speed of sound is comparable to the RMS speed.
Does the gas identity change the pressure at fixed n, V and T?
No — that is the point of the ideal gas law. Pressure depends on the number of molecules, not their mass. Mass matters for density and for the speed of the molecules, not for the pressure they exert at a given temperature.