Ideal Gas Law Calculator
Solve PV = nRT for pressure, volume, moles or temperature in any unit.
About
Ideal Gas Law Calculator
The ideal gas law ties together the four things that describe a gas. Fix any three and the fourth follows, which is why one equation covers inflating a tyre, sizing a reaction vessel and working out why a sealed jar cracks in a hot car.
The equation
PV = nRT
P is pressure, V is volume, n is the amount of gas in moles, T is absolute temperature, and R is the gas constant, 8.314463 J/(mol·K) since the 2019 redefinition of the SI base units fixed it exactly.
Rearranged for whichever value you need:
- P = nRT ÷ V
- V = nRT ÷ P
- n = PV ÷ RT
- T = PV ÷ nR
Temperature must be absolute
This is where the calculation usually fails. T has to be in kelvin, because the equation says that doubling the temperature doubles the pressure, and that is only true measured from absolute zero.
Consider a gas warmed from 20 °C to 40 °C. In celsius that looks like doubling. In kelvin it is 293.15 K to 313.15 K, a rise of 6.8%, and the pressure rises by 6.8% rather than doubling. Using celsius directly gives an answer wrong by a factor of two, and using it near 0 °C gives a division by zero.
Convert first: K = °C + 273.15, or K = (°F - 32) × 5/9 + 273.15.
A worked example
One mole of any gas at 0 °C and 1 atmosphere:
- T = 273.15 K, P = 101,325 Pa, n = 1 mol
- V = nRT ÷ P = 1 × 8.314463 × 273.15 ÷ 101,325
- V = 0.022414 m³ = 22.414 litres
That figure is the molar volume, and it holds for any ideal gas. A mole of hydrogen and a mole of carbon dioxide occupy the same 22.4 litres despite one weighing 2 grams and the other 44. Avogadro noticed this in 1811, well before anyone could explain it.
Which standard conditions?
The 22.4 L/mol figure everyone remembers uses 1 atm, which IUPAC replaced with 100 kPa in 1982. Both are still in circulation.
| Standard | Conditions | Molar volume |
|---|---|---|
| STP, current IUPAC | 0 °C, 100 kPa | 22.711 L/mol |
| STP, older | 0 °C, 1 atm | 22.414 L/mol |
| SATP | 25 °C, 100 kPa | 24.790 L/mol |
| Room temperature | 20 °C, 1 atm | 24.055 L/mol |
The gap between 22.414 and 22.711 is 1.3%, which matters in a titration calculation and does not matter when estimating how much helium fills a balloon. Textbooks published before the change use 22.4; check which one a problem expects.
The laws it contains
Three older laws are special cases of this one, each holding two variables fixed.
| Law | Held constant | Relationship |
|---|---|---|
| Boyle | n, T | P1V1 = P2V2 |
| Charles | n, P | V1÷T1 = V2÷T2 |
| Gay-Lussac | n, V | P1÷T1 = P2÷T2 |
| Avogadro | P, T | V1÷n1 = V2÷n2 |
The combined form, P1V1÷T1 = P2V2÷T2, handles any before-and-after problem where the amount of gas does not change. It needs no value for R at all, since R cancels from both sides.
Density and molar mass
Rearranging with mass in place of moles gives the density of a gas:
density = PM ÷ RT, where M is the molar mass
Oxygen at 0 °C and 1 atm works out at 32.00 ÷ 22.414 = 1.428 g/L. Air, averaging 28.96 g/mol, comes to 1.292 g/L. Carbon dioxide at 44.01 g/mol is 1.964 g/L, which is why it pools in the bottom of a container and why it can collect in cellars and silos.
Run the same relation backwards and a measured gas density identifies an unknown molar mass, which is how gas densities were used to determine atomic weights in the nineteenth century.
When gases stop being ideal
The law assumes molecules have no volume and no attraction to each other. Both assumptions hold well at ordinary pressures and temperatures well above the boiling point, and both fail as a gas approaches the conditions where it would liquefy.
At high pressure the molecules are pressed close enough that their own volume matters, which makes the real volume larger than predicted. At low temperature intermolecular attraction pulls them together, which makes the real pressure lower than predicted. The van der Waals equation adds a correction term for each effect.
For most laboratory and everyday work the error is under 1%, and the ideal law is used without apology. Steam near condensation, carbon dioxide in a cylinder at 60 bar, and any gas near its critical point need the fuller treatment.
Why tyre pressure drops in winter
A tyre is a fixed volume holding a fixed amount of air, so pressure tracks temperature directly. The catch is that the equation needs absolute pressure, and a gauge reads the amount above atmospheric.
A tyre at 32 psi on the gauge holds 46.70 psi absolute. Cool it from 20 °C to -10 °C, which is 293.15 K to 263.15 K:
- New absolute pressure: 46.70 × 263.15 ÷ 293.15 = 41.92 psi
- Back to gauge: 41.92 - 14.70 = 27.2 psi
Nearly 5 psi has gone, and nothing leaked. The same effect runs the other way on a motorway, where heat from the road adds a few psi, which is why pressures are specified cold. Doing this calculation on gauge pressure instead of absolute gives a drop of about 3.3 psi, understating it by a third.
Mixtures and partial pressures
In a mixture, n is the total moles of everything present and P is the total pressure. Each gas also contributes its own partial pressure in proportion to its share of the moles, which is Dalton's law.
Dry air is 78.08% nitrogen, 20.95% oxygen and 0.93% argon by mole fraction. At 101.325 kPa total, the oxygen partial pressure is 0.2095 × 101.325 = 21.23 kPa. That figure, rather than the percentage, is what governs breathing: at 5,500 m the atmosphere is still 20.95% oxygen while the partial pressure has roughly halved, which is why altitude affects people despite the composition being unchanged.
Gases that need a correction
The van der Waals equation adds two terms to handle real behaviour: one subtracting the volume the molecules themselves occupy, and one adding back the pressure lost to attraction between them.
The correction matters most for gases that are easy to liquefy. Carbon dioxide, ammonia and water vapour deviate noticeably at moderate pressures, while helium, hydrogen and nitrogen stay close to ideal well past 10 atmospheres. A quick check is the compressibility factor Z = PV ÷ nRT, which is 1 for an ideal gas; anything between 0.95 and 1.05 means the simple law is fine.
Common mistakes
Using celsius or fahrenheit. Convert to kelvin first, every time.
Mixing unit systems. Using 8.314 with pressure in atmospheres and volume in litres gives nonsense. Either use SI throughout, or switch to R = 0.082057 L·atm/(mol·K).
Using gauge pressure. A tyre reading 32 psi contains 46.7 psi absolute. The equation needs absolute pressure.
Forgetting the gas is a mixture. In a mixture, n is the total moles of everything present, and each component contributes its own partial pressure.
Common questions
Frequently asked questions
In SI units it is exactly 8.314462618 J/(mol K). Two other forms are common: 0.08205736 L atm/(mol K) when pressure is in atmospheres and volume in litres, and 62.363 L mmHg/(mol K). Pick the one matching your units rather than converting mid-calculation.
Because the relationship is proportional and only works measured from absolute zero. At 0 kelvin a gas would exert no pressure, which makes the scale meaningful; 0 celsius is an arbitrary point where water freezes and carries no such meaning. Using celsius makes the arithmetic wrong and can divide by zero.
IUPAC currently defines STP as 0 degrees celsius and 100 kPa, giving a molar volume of 22.711 L/mol. The older definition used 1 atmosphere, giving the familiar 22.414 L/mol. Both appear in textbooks, so check which one a problem intends.
Yes. Use the total moles of all the gases present, and the result is the total pressure. Each component also exerts its own partial pressure in proportion to its share of the moles, which is Daltons law of partial pressures.
Within about 1% for common gases at ordinary temperatures and pressures below a few atmospheres. Accuracy degrades as a gas approaches conditions where it would liquefy, so high pressure or low temperature calls for the van der Waals equation or a compressibility factor.
A gauge reads zero in open air, so it reports the amount above atmospheric. Absolute pressure includes the atmosphere itself. Add 101.325 kPa, or 14.696 psi, to a gauge reading to get the absolute figure the equation needs.
Use density = PM divided by RT, where M is the molar mass. Oxygen at 0 degrees celsius and 1 atm comes to 1.428 g/L. The same relation run backwards identifies an unknown molar mass from a measured density.
Because the volume depends on the number of molecules rather than their size or mass. In an ideal gas the molecules are treated as points with no volume of their own, so what fills the container is their motion, and equal numbers at the same temperature and pressure need equal space.