The ideal gas law (PV = nRT) with worked examples
How to use PV = nRT, which value of R to pick, the unit conversions that trip people up, and worked examples for P, V, n, T and molar mass.
PV = nRT relates four properties of a gas: pressure (P), volume (V), amount in moles (n) and absolute temperature (T). R is the gas constant. Give it any three and it returns the fourth. Most wrong answers come from units, not from the algebra, so this post spends as much time on units as on the equation.
Pick R to match your units
R has one physical value but different numbers in different units:
- 0.08206 L atm/(mol K): use with P in atm and V in liters. This is the default in most intro courses.
- 8.314 kPa L/(mol K), which is the same as 8.314 J/(mol K): use with P in kPa and V in liters.
- 62.36 L torr/(mol K): use with P in torr or mmHg and V in liters.
Whichever R you choose, T must be in kelvin, and the pressure and volume units must match that R. The conversions you'll need:
- 1 atm = 760 mmHg = 760 torr = 101.325 kPa
- 1 L = 1000 mL
- K = °C + 273.15
The ideal gas law calculator uses R = 0.082057 L atm/(mol K) internally (0.08206 rounded) and converts kPa, mmHg, torr, mL and °C for you.
Example 1: volume at STP
What volume does 1.00 mol of an ideal gas occupy at STP? This course follows OpenStax, which defines STP as 273.15 K and 1 atm.
V = nRT / P = (1.00 mol)(0.08206)(273.15 K) / 1.00 atm = 22.4 L
That's the molar volume, 22.4 L/mol at STP. Some older texts and IUPAC use 0 °C and 100 kPa (1 bar) for STP instead, which gives about 22.7 L, so check which definition your course uses.
Example 2: solve for pressure
0.500 mol of gas is in a 10.0 L container at 25 °C. What's the pressure?
- T = 25 + 273.15 = 298.15 K
- P = nRT / V = (0.500)(0.08206)(298.15) / 10.0 = 1.22 atm
Plugging in 25 instead of 298.15 gives 0.103 atm. That's the most common ideal gas mistake, and the result is off by more than a factor of 10. In this equation, Celsius is always wrong.
Example 3: solve for moles, with torr
A 2.50 L flask holds a gas at 745 torr and 22 °C. How many moles are there?
- P = 745 / 760 = 0.9803 atm
- T = 22 + 273.15 = 295.15 K
- n = PV / RT = (0.9803)(2.50) / ((0.08206)(295.15)) = 0.101 mol
You could skip the pressure conversion by using R = 62.36 L torr/(mol K) instead. You get the same answer either way.
Example 4: solve for temperature
0.0200 mol of gas fills 500. mL at 1.00 atm. What's the temperature?
- V = 500. mL = 0.500 L
- T = PV / nR = (1.00)(0.500) / ((0.0200)(0.08206)) = 305 K, which is 31.5 °C
If a problem asks for Celsius, solve in kelvin first and subtract 273.15 at the end.
Example 5: pressure in kPa
2.00 mol of gas in 15.0 L at 300 K, with the answer in kPa. Use R = 8.314 kPa L/(mol K):
P = (2.00)(8.314)(300) / 15.0 = 333 kPa
Using 0.08206 instead gives 3.282 atm, and 3.282 x 101.325 = 332.6 kPa, the same answer to three significant figures.
Example 6: molar mass from gas data
A 1.30 g sample of an unknown gas fills 1.00 L at 1.00 atm and 27 °C. What's its molar mass?
- T = 27 + 273.15 = 300.15 K
- n = PV / RT = (1.00)(1.00) / ((0.08206)(300.15)) = 0.04060 mol
- Molar mass = mass / moles = 1.30 g / 0.04060 mol = 32.0 g/mol
That matches O2 (31.998 g/mol). The same idea rearranges into two formulas worth knowing: gas density d = PM / RT, and molar mass M = dRT / P. For example, O2 at STP has a density of 31.998 / (0.08206 x 273.15) = 1.43 g/L.
When the amount of gas doesn't change
If n stays constant and the conditions change, you don't need R at all. Divide PV = nRT for the two states and everything constant cancels:
P1V1 / T1 = P2V2 / T2 (the combined gas law)
Boyle's law (P1V1 = P2V2 at constant T), Charles's law (V1/T1 = V2/T2 at constant P) and Gay-Lussac's law (P1/T1 = P2/T2 at constant V) are special cases of it. For example, 2.00 L of gas at 1.00 atm and 300 K is heated to 350 K and compressed to 2.50 atm:
V2 = P1V1T2 / (T1P2) = (1.00)(2.00)(350) / ((300)(2.50)) = 0.933 L
Temperatures still go in kelvin. Pressure and volume can be in any unit here, as long as each one matches on both sides.
Mixtures and partial pressures
In a mixture, each gas behaves as if it were alone, so PV = nRT works for each gas separately. The partial pressures add up to the total (Dalton's law), and each gas's share of the pressure equals its mole fraction. The one to remember for labs: a gas collected over water is mixed with water vapor, so subtract the vapor pressure of water (23.8 torr at 25 °C) from the total before using PV = nRT.
When "ideal" breaks down
The ideal gas law assumes gas particles take up no space and don't attract each other. Real gases come close at ordinary conditions, but drift away at high pressure, where particle volume matters, and at low temperature, where attractions matter. Intro courses treat the van der Waals equation qualitatively. For calculations, assume ideal behavior unless the problem says otherwise.
Checklist before you calculate
- Convert T to kelvin.
- Pick R, then convert P and V to match it.
- Rearrange for the unknown before plugging in numbers.
- Check that the answer is reasonable. A balloon at room conditions won't be at 0.1 atm, and a mole of gas at STP is about 22.4 L.
Practice
Work a few of each type by hand, then check yourself with the ideal gas law calculator. Gas stoichiometry combines this with the mole-ratio method in stoichiometry step by step. For exam strategy across the whole course, see how to study for a general chemistry exam. If you're also taking physics, the four kinematic equations and when to use each takes the same approach: pick the right equation, then do the units carefully.
Gases are unit 12 of Encodr's free General Chemistry I flashcards, with chapters on pressure units, the simple gas laws, PV = nRT, gas density, Dalton's law and effusion.
Ideal Gas Law Calculator
Solve PV = nRT for P, V, n or T with unit conversions and the steps shown.
Try it →Encodr turns this into a habit: study anything in a feed, and it schedules the rest.
Get started free