How to use ideal gas law to solve problems
Solve PV = nRT step by step: convert units, pick R, rearrange, and check the answer. Worked examples for P, V, n and T, plus problems in grams.
How to Use the Ideal Gas Law: Solved Examples
The ideal gas law, PV = nRT, connects pressure, volume, moles, and temperature of a gas. The ideal gas law must be used correctly because the single biggest mistake is forgetting that the gas constant R depends on the units you use for pressure and volume. Pick the wrong R, and your answer will be numerically correct but physically meaningless. Solve for any variable step by step with worked examples and real-world checks.
Step 1: List Knowns and Convert Units
Write down every number the problem gives you, including its unit. You need three of the four variables (P, V, n, T) to solve for the fourth. Convert temperature to Kelvin first. This is where most errors start: T(K) = T(°C) + 273.15. If the problem gives Fahrenheit, convert to Celsius first, then add 273.15. Volume must be in liters when using the common R = 0.082057 L·atm/(mol·K). Pressure must be in atmospheres. If your numbers are in different units, convert them now, do not wait until later. For example, a pressure of 760 mmHg is exactly 1 atm; 1 bar is 0.9869 atm. The OpenStax Chemistry 2e text (chapter 9, sections 9.2-9.3) recommends writing every conversion step down to avoid dropped factors.
Step 2: Choose the Right R Value
The molar gas constant R has one fundamental value from CODATA 2018/2022: 8.314462618 J/(mol·K). Since the 2019 SI redefinition, that value is exact. But you will use its unit-converted forms in practice. For student chemistry problems, the most common values are:
0.082057 L·atm/(mol·K), use when pressure is in atm, volume in L, temperature in K.
62.364 L·Torr/(mol·K), use when pressure is in Torr (mmHg), volume in L.
8.314 L·kPa/(mol·K), use when pressure is in kPa, volume in L.
If you have pressure in psi and volume in cubic feet, you need R = 10.7316 psi·ft³/(lb-mol·°R). Important: That value is per pound-mole, not per gram-mole. Using 0.082057 with psi and ft³ will give an answer off by a factor of about 454 (the grams-per-pound conversion) times 14.696 (psi-to-atm). Check your units before you pick R.
Step 3: Rearrange and Solve
Write PV = nRT on your paper. Solve for the variable you need:
If unknown is P: P = nRT / V
If unknown is V: V = nRT / P
If unknown is n: n = PV / (RT)
If unknown is T: T = PV / (nR)
Plug your known values into the rearranged equation. Use the R that matches your units. Multiply and divide carefully. Check that the units cancel to leave the unit you expect: for P, that is atm; for V, L; for n, mol; for T, K.
Ideal Gas Law Problems: Four Worked Examples
Example 1: Finding Pressure
Problem: A 22.4 L container holds 1.00 mol of an ideal gas at 273 K. What is the pressure in atm?
Known: V = 22.4 L, n = 1.00 mol, T = 273 K. Unknown: P.
Equation: P = nRT / V.
Use R = 0.082057 L·atm/(mol·K).
P = (1.00 mol × 0.082057 L·atm/(mol·K) × 273 K) / 22.4 L.
Numerator: 1.00 × 0.082057 × 273 = 22.4 (approx). Then 22.4 / 22.4 = 1.00 atm.
This matches the old STP definition (0 °C, 1 atm). Under the current IUPAC standard (0 °C, 1 bar), the pressure would be 0.9869 atm, so the answer is 1.00 atm only if your problem uses the older definition. Know which STP your textbook or exam uses.
Example 2: Finding Volume
Problem: A balloon contains 2.50 mol of gas at 298 K and 1.20 atm. What is its volume in liters?
Known: n = 2.50 mol, T = 298 K, P = 1.20 atm. Unknown: V.
Equation: V = nRT / P.
Use R = 0.082057 L·atm/(mol·K).
V = (2.50 mol × 0.082057 L·atm/(mol·K) × 298 K) / 1.20 atm.
Numerator: 2.50 × 0.082057 × 298 = 61.13. Then 61.13 / 1.20 = 50.9 L.
Check: At room temperature (298 K) and near 1 atm, one mole occupies about 24.4 L, so 2.5 moles should occupy about 61 L. The result of 50.9 L is close, and the difference comes from the pressure being slightly above 1 atm.
Example 3: Finding Moles from Grams
Problem: A gas sample occupies 15.0 L at 2.00 atm and 350 K. The gas has a mass of 18.5 g. How many moles are present? What is the molar mass?
First, find moles from PV = nRT. Unknown: n.
n = PV / (RT) = (2.00 atm × 15.0 L) / (0.082057 L·atm/(mol·K) × 350 K).
Numerator: 30.0. Denominator: 28.72. n = 30.0 / 28.72 = 1.044 mol.
Now find molar mass: M = mass / n = 18.5 g / 1.044 mol = 17.7 g/mol.
This is close to ammonia (NH₃, molar mass 17.03 g/mol). The small difference could be measurement error or slight non-ideality. If the problem gives mass instead of moles, always convert mass to moles first using n = m / M, then solve for the unknown.
Example 4: Finding Temperature
Problem: A 5.00 L cylinder contains 0.200 mol of gas at a pressure of 3.25 atm. What is the temperature in °C?
Known: V = 5.00 L, n = 0.200 mol, P = 3.25 atm. Unknown: T.
Equation: T = PV / (nR).
Use R = 0.082057 L·atm/(mol·K).
T = (3.25 atm × 5.00 L) / (0.200 mol × 0.082057 L·atm/(mol·K)).
Numerator: 16.25. Denominator: 0.200 × 0.082057 = 0.0164114. T = 16.25 / 0.0164114 = 990.2 K.
Convert to Celsius: T(°C) = 990.2 − 273.15 = 717.1 °C.
This is very hot, above the melting point of aluminum. The cylinder would need to be rated for high temperature. This is a physically reasonable result for a small volume at high pressure.
Common Mistakes With the Ideal Gas Law
Most errors fall into predictable categories. Check your work against this list before reporting an answer.
Temperature not in Kelvin. Using Celsius in the equation adds or subtracts 273.15 from the correct answer. Always convert first. The combined gas law (P₁V₁/T₁ = P₂V₂/T₂) also requires Kelvin.
Wrong R value. Using 8.314 J/(mol·K) when your pressure is in atm and volume in L will give an answer off by a factor of 101.3 (since 1 L·atm = 101.325 J). Match R to the units in your problem.
Units not converted. If pressure is given in psi and volume in cubic feet, you cannot use 0.082057. Convert to atm and L, or use the correct R for those units (10.7316 psi·ft³/(lb-mol·°R), remembering it is per pound-mole.
STP shortcut misuse. The molar volume of an ideal gas at 0 °C and 1 atm is 22.414 L/mol. At 0 °C and 1 bar (IUPAC standard since 1982), it is 22.710 L/mol. Using 22.4 L/mol for the 1-bar definition introduces a 1.4 % error. Worse, applying the shortcut to water vapor at 0 °C gives a numerical answer for a state that is physically liquid or ice, the ideal gas law does not apply below the boiling point.
Significant figures ignored. Report your answer with the same number of significant figures as the least precise measurement given. Using six significant figures for R (0.082057) does not make a three-significant-figure input more accurate.
| Step | Action | Failure Case |
|---|---|---|
| Step 1 | Write knowns with units | Skipping unit labels leads to mismatched conversions |
| Step 2 | Convert T to Kelvin | Using °C gives T off by 273.15 |
| Step 3 | Choose R to match P and V units | Using wrong R gives factor-of-101 error |
| Step 4 | Rearrange equation for unknown | Algebra error in solving for T or n |
| Step 5 | Plug in numbers, cancel units | Unit mismatch not checked before calculation |
| Step 6 | Check answer plausibility | Result far from expected range (e.g., 0.01 L for a balloon) |
Ideal Gas Law Examples: What to Do When Things Go Wrong
If your answer does not make physical sense, go back to the unit check. A common failure mode is using the combined gas law (P₁V₁/T₁ = P₂V₂/T₂) when the number of moles changes, for example, if gas is added to or removed from a container. The combined gas law only works when n is constant. If the problem says "a leak develops" or "more gas is pumped in", you must use PV = nRT directly.
Another failure: calculating gas density using the formula ρ = PM / RT and getting a result that is too low. This happens when the gas is near its boiling point, where intermolecular forces become significant. For CO₂ at 0 °C and 1 atm, the ideal gas law predicts a density about 2-5 % lower than the real value. The van der Waals equation gives the correction: (P + a(n/V)²)(V − nb) = nRT, where a corrects for attraction and b for molecular volume. For most student problems, the error is small enough to ignore, but knowing when the approximation fails matters.
If your calculated temperature is below absolute zero (0 K), you have made a sign error or used the wrong R. There is no such thing as a negative Kelvin temperature.
Ideal Gas Law Steps for Different Variables
Solve for Moles (n) When Given Mass
Some problems give the mass of the gas and ask for moles, then use that to find another variable. The step is: first find n = m / M, where m is the mass in grams and M is the molar mass in g/mol. Then plug n into PV = nRT. For example, from the previous worked example, 18.5 g of a gas with molar mass 17.7 g/mol gives 1.045 mol. If the problem does not give the molar mass, you can solve for it by rearranging: M = mRT / PV.
Solve for Molar Mass From Density
If you know the gas density ρ (mass per volume), you can find the molar mass using M = ρRT / P. This is useful in lab contexts where you weigh a known volume of gas. The error here is high: a 0.1 g error in mass on a 1 g sample produces a 10 % error in M. Use this method only when the sample is at least several grams.
Solve for Conditions at STP
Many problems ask for volume at STP. The IUPAC definition (since 1982) is 273.15 K and 1 bar (10⁵ Pa). The molar volume at these conditions is 22.710 L/mol. The older definition (0 °C, 1 atm) gives 22.414 L/mol. Your textbook probably uses one or the other; check which. If the problem says "at STP" without further detail, assume the IUPAC standard unless your course materials say otherwise.
Common Questions
What is the most common mistake when solving ideal gas law problems?
Forgetting to convert temperature to Kelvin. Using Celsius directly adds or subtracts 273.15 from the absolute temperature and makes the answer wrong by roughly that fraction. Always add 273.15 to °C before plugging into PV = nRT.
Which R value should I use?
Match R to the units of pressure and volume in your problem. For pressure in atm and volume in L, use 0.082057 L·atm/(mol·K). For pressure in kPa, use 8.314 L·kPa/(mol·K). For pressure in Torr (mmHg), use 62.364 L·Torr/(mol·K). Using the wrong R gives a numerically correct but physically wrong answer.
Can I use 22.4 L/mol for volume at STP?
Only if your problem uses the old STP definition (0 °C, 1 atm). The IUPAC standard since 1982 uses 1 bar, giving a molar volume of 22.710 L/mol. Using 22.4 for the IUPAC definition introduces a 1.4 % error. Always check which definition your textbook or exam uses.
What do I do if the problem gives mass instead of moles?
Convert mass to moles first: n = mass / molar mass. Then use PV = nRT to solve for the unknown. If molar mass is not given, you can find it by rearranging: M = mass × RT / (PV).
When does the ideal gas law fail?
It fails at high pressure (above about 5 atm for most gases) and low temperature (near the gas's boiling point). The van der Waals equation corrects for these effects. For general chemistry problems at room temperature and near 1 atm, the error is typically 0.1-3 %, which is acceptable for student calculations.