What the ideal gas law states
The ideal gas law fixes the relationship between the four quantities that fully describe a gas sample: how hard it pushes (pressure), how much room it fills (volume), how much of it there is (moles), and how hot it is (absolute temperature). Fix any three and the fourth is determined. That is a remarkable claim — it says the chemical identity of the gas does not matter. A mole of helium and a mole of sulfur hexafluoride occupy the same volume at the same pressure and temperature, despite a 36-fold difference in molar mass.
The equation is PV = nRT, where R is the universal gas constant. R exists purely to reconcile the units: it is the constant of proportionality between PV, which has the dimensions of energy, and nT. Its numerical value therefore changes with the unit system, and choosing the wrong version of R is the second most common error in gas calculations after forgetting kelvin.
The law is a consolidation of the three simple gas laws discovered separately in the seventeenth to nineteenth centuries. Boyle's law (PV constant at fixed T and n), Charles's law (V proportional to T at fixed P and n) and Avogadro's law (V proportional to n at fixed P and T) each capture one slice; multiply them together and PV = nRT falls out.
You reach for it whenever you need to convert between a gas measured as a volume and a gas measured as an amount. Filling a reaction vessel to a target pressure, working out how many grams of propane a cylinder holds, converting a gas-chromatography injection volume to moles, or sizing a vent for a decomposition that releases gas all reduce to one application of this equation.
Reading each variable, and choosing the right R
P is absolute pressure. Not gauge pressure. A tyre gauge reading 30 psi on a gauge is 30 psig, which is about 44.7 psia — the gauge subtracts atmospheric pressure. Every pressure sensor labelled “g” needs local atmospheric pressure added before it enters PV = nRT. Use absolute units: atm, bar, kPa absolute, psia, or mmHg.
V is the free internal volume. If the vessel contains liquid or packing, subtract it. A 500 mL round-bottom flask holding 100 mL of solution has 400 mL of headspace for the gas.
n is the amount in moles. If you have a mass, divide by molar mass: n = m/M. This calculator does the reverse for you — supply a molar mass and it reports both the mass and the density.
T is absolute temperature. Kelvin or Rankine only. Every one of the four rearrangements either multiplies or divides by T, so a Celsius value simply produces a wrong answer rather than a nearly-right one. At room temperature, using 25 instead of 298.15 is a twelve-fold error.
R depends on the units you chose. The physical constant is fixed — the SI value is exactly 8.314462618 J/(mol·K) since the 2019 redefinition of the mole and the kelvin — but its numerical expression is not. This calculator works internally in litre-atmospheres, using R = 0.08205737 L·atm/(mol·K), and converts your inputs into atm and litres first. If you are checking a hand calculation, use the table below to pick the matching R.
A useful rearrangement worth memorising is the density form, ρ = PM/(RT). It says gas density rises linearly with pressure and with molar mass and falls inversely with absolute temperature — which is why hot air rises, why carbon dioxide pools in a pit, and why a helium balloon lifts.
Worked example: how many moles are in a 5.00 L cylinder at 2.00 atm and 27 °C?
A 5.00 L stainless cylinder is filled with nitrogen to an absolute pressure of 2.00 atm at 27 °C. How many moles does it hold, and what does that gas weigh?
- Convert the temperature. T = 27 + 273.15 = 300.15 K. For a clean hand check, use 300 K.
- Pick R to match the units. Pressure is in atm and volume in litres, so R = 0.0820574 L·atm/(mol·K).
- Form the denominator. R × T = 0.0820574 × 300 = 24.6172 L·atm/mol.
- Form the numerator. P × V = 2.00 atm × 5.00 L = 10.00 L·atm.
- Divide. n = 10.00 ÷ 24.6172 = 0.40622 mol.
- Convert to mass. Nitrogen is N₂, M = 28.014 g/mol, so m = 0.40622 × 28.014 = 11.38 g.
- Density check. ρ = m ÷ V = 11.38 ÷ 5.00 = 2.276 g/L. Cross-check with ρ = PM/(RT) = (2.00 × 28.014) ÷ 24.6172 = 2.276 g/L. The two routes agree, which confirms the arithmetic.
Now change one thing to see the sensitivity. Warm the same cylinder to 127 °C (400.15 K) without venting it. The volume is fixed and n is fixed, so the pressure rises in proportion to absolute temperature: P₂ = 2.00 × 400.15 ÷ 300.15 = 2.666 atm. That is a 33% pressure rise for a 100 °C warming, which is why gas cylinders carry a maximum storage temperature.
The gas constant R in common unit systems
| Value of R | Units | Use when P is in… | …and V is in |
|---|---|---|---|
| 0.08205737 | L·atm/(mol·K) | atm | litres |
| 8.314463 | J/(mol·K) | Pa | m³ |
| 8.314463 | L·kPa/(mol·K) | kPa | litres |
| 0.08314463 | L·bar/(mol·K) | bar | litres |
| 62.36360 | L·mmHg/(mol·K) | mmHg (torr) | litres |
| 1.987204 | cal/(mol·K) | — | energy form |
| 10.73159 | ft³·psi/(lbmol·°R) | psia | cubic feet |
The calorie row is the energy form used in older thermodynamic tables; it is not paired with a pressure and volume unit.
Molar volume under the standard states you may be asked for
| Reference state | Temperature | Pressure | Molar volume |
|---|---|---|---|
| IUPAC STP (since 1982) | 0 °C (273.15 K) | 100 kPa (1 bar) | 22.711 L/mol |
| Former IUPAC STP | 0 °C (273.15 K) | 101.325 kPa (1 atm) | 22.414 L/mol |
| NIST standard conditions | 20 °C (293.15 K) | 101.325 kPa (1 atm) | 24.055 L/mol |
| SATP / ambient | 25 °C (298.15 K) | 100 kPa (1 bar) | 24.790 L/mol |
| Room conditions, 1 atm | 25 °C (298.15 K) | 101.325 kPa (1 atm) | 24.465 L/mol |
The extremes here are 22.414 and 24.790 L/mol, a spread of 10.6%. A gas volume quoted without its reference state cannot be converted to moles.
How far you can trust the answer
Ask two questions: is the pressure low, and is the temperature well above the boiling point? If both answers are yes, the ideal gas law is accurate to better than one percent and you can stop worrying.
The formal measure of the departure is the compressibility factor Z = PV/(nRT), which equals exactly 1 for an ideal gas. For nitrogen, oxygen and air near room temperature, Z stays within about 1% of unity up to roughly 10 atm; by 100 atm the error is tens of percent. Gases that condense easily — ammonia, carbon dioxide, propane, water vapour — deviate sooner, because intermolecular attraction pulls the molecules together and the real volume falls below the ideal prediction. Above the critical temperature and at high pressure the effect reverses: the finite size of the molecules dominates and the real volume exceeds the ideal one.
Two practical checks catch most mistakes. First, look at the molar volume this calculator reports. Anywhere near room conditions it should land between about 20 and 30 L/mol. A value of 2 L/mol means a unit slipped by a factor of ten somewhere; a value of 0.02 L/mol is a liquid density and the model does not apply. Second, sanity-check the density against a known gas: air is about 1.2 g/L at room conditions, hydrogen about 0.082 g/L, carbon dioxide about 1.8 g/L.
When the answer matters and the pressure is high, move to a real-gas equation of state — van der Waals for teaching, Peng-Robinson or Soave-Redlich-Kwong for process work — or look up a tabulated Z. For gas mixtures, apply Dalton's law of partial pressures: each component obeys PV = nRT with its own partial pressure, and the total pressure is the sum.
Errors that make PV = nRT give the wrong answer
- Gauge pressure instead of absolute. Add local atmospheric pressure — roughly 14.7 psi or 101 kPa at sea level — to any gauge reading before it goes into the equation.
- Celsius instead of kelvin. Every rearrangement uses T directly, so a Celsius value is not a small error; at room temperature it is off by a factor of twelve.
- An R that does not match the units. Using 8.314 with pressure in atm and volume in litres throws the answer out by the factor 101.325 — too large if you solved for P or V, too small if you solved for n or T, because R sits on opposite sides of those rearrangements. Match R to your units or convert first.
- Counting the vessel's total volume instead of the headspace. Liquid, catalyst and packing all displace gas.
- Applying it near condensation or above about 10 atm. The deviation is systematic, not random, and it always makes the real volume differ from the ideal one in a predictable direction for a given gas and state.
- Treating a gas mixture as a single species. Use partial pressures for each component, or an average molar mass for density work — 28.96 g/mol for dry air is exactly such an average.
Where to go beyond PV = nRT
If your problem holds one variable fixed, a two-state form is faster and needs no value of R at all. With n and T fixed you have Boyle's law, P₁V₁ = P₂V₂. With n and P fixed you have Charles's law, V₁/T₁ = V₂/T₂. With n and V fixed you have Gay-Lussac's law, P₁/T₁ = P₂/T₂. All three drop out of PV/(nT) being constant.
For gases participating in reactions, PV = nRT is the bridge between the measured volume and the stoichiometry: convert to moles, run the mole ratio, convert back. When the gas is a reactant or product at equilibrium, the partial pressures feed straight into the equilibrium constant as Kp, and the reaction quotient tells you which way the system will move. When the gas is dissolving rather than filling a container, Henry's law replaces this equation, and the colligative behaviour of the resulting solution is handled by osmotic pressure — which, notably, has the identical form Π = (n/V)RT.
The energy side of a gas process is separate arithmetic. Heating a gas at constant pressure does work on the surroundings equal to PΔV, and the heat required follows from its heat capacity; use the calorimetry calculator for the q = mcΔT part and the Gibbs free energy calculator for whether a gas-phase process runs at all.
