The Ideal Gas Law

General Chemistry · Gas Laws and Ideal Gas Calculations

Dr. Ray’s Learning Center · covers: The Ideal Gas Law

  • 25 to 35 min
  • 10 figures
  • 4 worked examples
  • 5 practice sets
  • 1 simulator

Before this lesson:

A weather balloon is filled at ground level, a scuba tank is packed with air at high pressure, and an air bag inflates in a few hundredths of a second. In each case someone had to know how much gas fills a given space at a given pressure and temperature. One equation answers all of these questions for most gases near room conditions: the ideal gas law.

In this lesson you will use PV=nRTPV = nRT with consistent units, find the volume of a gas at standard conditions, and work out the density and the molar mass of a gas from measured data (Figure 1).

  1. DataP, V, T, n or m
  2. +273.15+ 273.15°C to K; mL to L; P in the unit of R
  3. Consistent units
  4. RRsolve PV=nRTPV = nRT for the unknown
  5. Unknownn, V, P or T
  6. ×M\times Ma mass, density or molar mass
  7. Answer3 s.f.

PV=nRTPV = nRT with T in K.At STP: V=n×22.414L/molV = n \times 22.414\,\text{L/mol}.d=PMRTd = \dfrac{PM}{RT} and M=mnM = \dfrac{m}{n}.

Figure 1. The ideal gas roadmap: put the data in consistent units, solve PV=nRTPV = nRT for the unknown, then finish with the molar mass when the question asks for grams, a density or a molar mass.

Learning Objectives

After this lesson, you should be able to:

  1. Use PV=nRTPV = nRT with consistent units and the right value of RR.
  2. Calculate gas density and molar mass from PVT data.

Key Ideas

1. Pressure, Volume, Temperature and Amount

Four quantities describe a sample of gas: its pressure PP, its volume VV, its temperature TT and its amount of substance nn. Pressure is force per unit area. A barometer measures the pressure of the atmosphere as the height of a mercury column, which is where the units mmHg and torr come from (1 torr is the same as 1 mmHg). The SI unit is the pascal; chemists usually use kPa, atm or bar:

1atm=760torr=101.325kPa1\,\text{atm} = 760\,\text{torr} = 101.325\,\text{kPa}
1bar=100kPa1\,\text{bar} = 100\,\text{kPa}

Gas laws need the absolute temperature, on the Kelvin scale. Add 273.15 to a Celsius temperature:

T(K)=t(°C)+273.15T\,(\text{K}) = t\,(\text{°C}) + 273.15

Figure 2 shows both conversions on one scale each. A temperature of 0 °C is 273.15 K, not zero: a gas at 0 °C still has plenty of thermal energy.

Celsius and Kelvin temperature scalesPanel (a): two parallel scales. Absolute zero is minus 273.15 degrees Celsius and 0 kelvins; water freezes at 0 degrees Celsius, 273.15 kelvins; water boils at 100 degrees Celsius, 373.15 kelvins. Add 273.15 to a Celsius temperature to get kelvins.(a)Two temperature scales°CK−273.150absolute zero0273.15water freezes100373.15water boilsadd 273.15 to °COne pressure in four unitsPanel (b): four equal bars show the same pressure: 1 atmosphere, 760 torr, 101.325 kilopascals and 1.01325 bar. One torr is one millimeter of mercury and one bar is 100 kilopascals.(b)One pressure, four units1 atm760 torr101.325 kPa1.01325 bar1 torr is 1 mmHg; 1 bar is 100 kPa
Figure 2. Panel (a): the Kelvin scale starts at absolute zero, so a Kelvin temperature is the Celsius temperature plus 273.15. Panel (b): the same pressure written in four units.

Key idea: before you use any gas law, put the temperature in K and know which unit your pressure is in. Every later step depends on these two choices.

2. The Ideal Gas Law

Boyle’s, Charles’s and Avogadro’s laws combine into one equation that links all four variables of a gas sample:

PV=nRTPV = nRT

RR is the gas constant. Its value depends on the units you use for pressure and volume, so pick the RR whose units match your data (Figure 3). With the pressure in atm and the volume in L, use R=0.08206L·atm/(mol·K)R = 0.08206\,\text{L·atm/(mol·K)}; with kPa and L, use R=8.314L·kPa/(mol·K)R = 8.314\,\text{L·kPa/(mol·K)}. Rearrange the equation for whichever variable is unknown, for example V=nRTPV = \frac{nRT}{P} or n=PVRTn = \frac{PV}{RT}.

P in atm: R=0.08206L·atm/(mol·K)R = 0.08206\,\text{L·atm/(mol·K)}

P in kPa: R=8.314L·kPa/(mol·K)R = 8.314\,\text{L·kPa/(mol·K)}

P in torr: R=62.36L·torr/(mol·K)R = 62.36\,\text{L·torr/(mol·K)}

Energy units: R=8.314J/(mol·K)R = 8.314\,\text{J/(mol·K)}

Figure 3. One gas constant, three sets of units: choose the RR whose pressure unit matches your data. The volume is always in L and the temperature in K.

At constant volume and temperature, the pressure is proportional to the number of moles: twice as many molecules hit the walls twice as often (Figure 4). If the question asks for a mass, PV=nRTPV = nRT gives moles first; multiply by the molar mass from The Mole and Molar Mass to get grams.

A gas sample with n molesPanel (a): a closed box of fixed volume and temperature holds six molecules; the gas exerts a pressure P.(a)n moles of gasPsame V and TThe same box with twice the molesPanel (b): the same box at the same temperature holds twelve molecules, twice as many; the pressure doubles to 2P.(b)2n moles of gas2Psame V and T
Figure 4. Panel (a): nn moles of gas in a fixed volume at a fixed temperature exert a pressure PP. Panel (b): twice as many moles in the same box exert 2P2P.

Key idea: PV=nRTPV = nRT with TT in K, VV in L, nn in mol, and an RR whose pressure unit matches PP. The equation gives moles, not grams.

Note: a real gas follows PV=nRTPV = nRT closely at ordinary temperatures and pressures. At very high pressure or low temperature it deviates, because its molecules have volume and attract each other (Whitten Sec. 12-15). This lesson treats every gas as ideal.

3. Standard Conditions and Molar Volume

To compare gases, chemists use a reference called standard temperature and pressure (STP). In this lesson, as in Whitten, STP means exactly 273.15 K (0 °C) and 1 atm. One mole of any ideal gas then occupies the standard molar volume:

Vm=RTP≈22.414L/molV_\mathrm{m} = \dfrac{RT}{P} \approx 22.414\,\text{L/mol}

So at STP you can go straight from moles to liters: multiply the moles by 22.414 L for each mole. This shortcut works only at STP; at any other temperature or pressure, use PV=nRTPV = nRT.

Note: IUPAC now defines standard pressure as 1 bar (100 kPa). At 273.15 K and 1 bar one mole occupies 22.711 L, about 1.3% more (Figure 5). Every problem on this page states which standard it uses; when a problem says STP, it means 273.15 K and 1 atm.

Standard molar volume at 1 atmosphere and at 1 barTwo bars drawn to scale from zero. At 273.15 kelvins and 1 atmosphere one mole of ideal gas occupies 22.414 liters; at 273.15 kelvins and 1 bar it occupies 22.711 liters, about 1.3 percent more.Volume of 1 mol of ideal gas at 273.15 Kat 1 atm (STP in this lesson)22.414 Lat 1 bar (IUPAC standard)22.711 L1 bar is a slightly lower pressure,so the volume is about 1.3% larger
Figure 5. Standard molar volume: 22.414 L at 273.15 K and 1 atm (STP in this lesson, as in Whitten) and 22.711 L at 273.15 K and 1 bar (IUPAC).

Key idea: at STP (273.15 K and 1 atm), 1 mol of an ideal gas occupies 22.414 L. Convert grams to moles first, then multiply by the molar volume.

4. Gas Density and Molar Mass

Writing n=mMn = \frac{m}{M} in the ideal gas law and dividing by VV gives the density d=mVd = \frac{m}{V} of a gas:

d=PMRTd = \dfrac{PM}{RT}

A gas with a larger molar mass is denser (Figure 6), and any gas becomes denser when it is compressed or cooled. Unlike liquids, gas densities are usually quoted in g/L. Run the same idea backwards to identify an unknown gas: measure its mass, volume, pressure and temperature, find nn from PV=nRTPV = nRT, and divide:

Densities of five gases at STPFive horizontal bars drawn to scale from zero, in order of molar mass. At 273.15 kelvins and 1 atmosphere the densities are: helium 0.179, methane 0.716, nitrogen 1.25, oxygen 1.43 and carbon dioxide 1.96 grams per liter. The larger the molar mass, the denser the gas.Gas density at STP273.15 K and 1 atm; values in g/LHe0.179CH₄0.716N₂1.25O₂1.43CO₂1.96larger molar mass, denser gas
Figure 6. Densities of five gases at STP (273.15 K and 1 atm): at the same PP and TT, d=PMRTd = \frac{PM}{RT} is proportional to the molar mass, so carbon dioxide is about 11 times as dense as helium.
M=mnM = \dfrac{m}{n}

Key idea: density d=PMRTd = \frac{PM}{RT} in g/L; molar mass M=mnM = \frac{m}{n} with nn from PV=nRTPV = nRT. Grams on top in both.

Try it: explore the ideal gas law

Pick the unknown, set the other three variables, switch the pressure unit to see which RR matches, and use the worked-example buttons to replay each example on the sliders.

Loading the simulator…

5. A Strategy for Ideal Gas Problems

Follow the roadmap in Figure 1:

  1. List the data and the unknown. Write each quantity with its unit.
  2. Convert: the temperature to K, the volume to L, and the pressure to the unit of your RR (or choose the RR that matches the pressure).
  3. Solve PV=nRTPV = nRT for the unknown; at STP you may use 22.414 L/mol instead.
  4. Finish: multiply moles by MM for a mass, use d=PMRTd = \frac{PM}{RT} for a density, or divide grams by moles for a molar mass. Keep 4 significant figures until the last step and round the answer to 3.

Exam tip: check the size of your answer. One mole of gas near room conditions fills roughly 20 to 25 L. An answer far outside that range for about a mole usually means a Celsius temperature or a mismatched RR.

Worked Example 1: The Volume of a Gas Sample

Problem: A cylinder holds 0.425 mol of nitrogen gas, N2, at 745 torr and 26.5 °C. What volume does the gas occupy, in L?

Step 1. Convert the temperature to K.

T=(26.5+273.15)K=299.65K\begin{aligned} T &= (26.5 + 273.15)\,\text{K} = 299.65\,\text{K} \end{aligned}

Step 2. Convert the pressure to atm, to match RR in L·atm/(mol·K).

P=745torr×1atm760torr≈0.9803atm\begin{aligned} P &= 745\,\text{torr} \times \dfrac{1\,\text{atm}}{760\,\text{torr}} \approx 0.9803\,\text{atm} \end{aligned}

Step 3. Solve PV=nRTPV = nRT for VV and substitute nn in mol, R=0.08206L·atm/(mol·K)R = 0.08206\,\text{L·atm/(mol·K)}, TT in K and PP in atm. The mol, K and atm cancel, leaving L.

V=nRTP=(0.425)(0.08206)(299.65)0.9803L≈10.66L≈10.7L\begin{aligned} V &= \dfrac{nRT}{P} \\ &= \dfrac{(0.425)(0.08206)(299.65)}{0.9803}\,\text{L} \\ &\approx 10.66\,\text{L} \approx 10.7\,\text{L} \end{aligned}

Final Answer: 10.7 L of N2

The pressure, 0.9803 atm, is rounded to 4 significant figures; the unrounded value gives the same answer. Check: 0.425 mol at about room temperature and 1 atm should fill a little less than half of 22 L or so, and it does.

  1. Temperature in KT=299.65KT = 299.65\,\text{K}Step 1
  2. ×1atm760torr\times \dfrac{1\,\text{atm}}{760\,\text{torr}}Step 2: 745 torr to atm
  3. Pressure in atmP≈0.9803atmP \approx 0.9803\,\text{atm}
  4. V=nRTPV = \dfrac{nRT}{P}Step 3: R in L·atm/(mol·K), n 0.425 mol
  5. Volume of N₂V≈10.66L≈10.7LV \approx 10.66\,\text{L} \approx 10.7\,\text{L}
Figure 7. Worked Example 1: temperature in K, pressure in atm to match RR, then V=nRTPV = \frac{nRT}{P}.

Your turn: solve for one unknown

Same steps as Worked Example 1: temperature to K, match the pressure unit to RR, then solve PV=nRTPV = nRT for the unknown (a mass needs one more step).

Loading the practice problem…

Worked Example 2: A Volume at STP

Problem: What volume does 12.8 g of carbon dioxide, CO2, occupy at STP (0 °C and 1 atm)? The molar mass of CO2 is 44.01 g/mol.

Step 1. Convert the mass to moles.

n=12.8g44.01g/mol≈0.2908mol\begin{aligned} n &= \dfrac{12.8\,\text{g}}{44.01\,\text{g/mol}} \approx 0.2908\,\text{mol} \end{aligned}

Step 2. Multiply by the standard molar volume (273.15 K and 1 atm).

V=0.2908mol×22.414L1mol≈6.518L≈6.52L\begin{aligned} V &= 0.2908\,\text{mol} \times \dfrac{22.414\,\text{L}}{1\,\text{mol}} \\ &\approx 6.518\,\text{L} \approx 6.52\,\text{L} \end{aligned}

Final Answer: 6.52 L of CO2 at STP

The moles, 0.2908 mol, are rounded to 4 significant figures; the unrounded value gives the same answer. At the IUPAC standard (273.15 K and 1 bar) the molar volume is 22.711 L/mol, so the same gas would occupy a little more (moles kept to 5 significant figures here):

V≈0.29084mol×22.711L1mol≈6.61LV \approx 0.29084\,\text{mol} \times \dfrac{22.711\,\text{L}}{1\,\text{mol}} \approx 6.61\,\text{L}

Always say which standard you mean.

  1. Mass of CO₂12.8g12.8\,\text{g}
  2. ×1mol44.01g\times \dfrac{1\,\text{mol}}{44.01\,\text{g}}Step 1: molar mass of CO₂
  3. Moles of CO₂n≈0.2908moln \approx 0.2908\,\text{mol}
  4. ×22.414L/mol\times 22.414\,\text{L/mol}Step 2: STP: 273.15 K and 1 atm
  5. Volume at STPV≈6.518L≈6.52LV \approx 6.518\,\text{L} \approx 6.52\,\text{L}
Figure 8. Worked Example 2: grams to moles, then the standard molar volume (273.15 K and 1 atm).

Your turn: a volume at STP

Same two steps as Worked Example 2: grams to moles with the molar mass, then multiply by 22.414 L for each mole.

Loading the practice problem…

Worked Example 3: The Density of a Gas

Problem: What is the density of argon, Ar, at 1.75 atm and 42.0 °C, in g/L? The molar mass of Ar is 39.95 g/mol.

Step 1. Convert the temperature to K.

T=(42.0+273.15)K=315.15K\begin{aligned} T &= (42.0 + 273.15)\,\text{K} = 315.15\,\text{K} \end{aligned}

Step 2. Use the density form of the ideal gas law. The pressure is already in atm, so use R=0.08206L·atm/(mol·K)R = 0.08206\,\text{L·atm/(mol·K)}.

d=PMRT=(1.75atm)(39.95g/mol)(0.08206L·atm/(mol·K))(315.15K)≈2.703g/L≈2.70g/L\begin{aligned} d &= \dfrac{PM}{RT} = \dfrac{(1.75\,\text{atm})(39.95\,\text{g/mol})}{(0.08206\,\text{L·atm/(mol·K)})(315.15\,\text{K})} \\ &\approx 2.703\,\text{g/L} \approx 2.70\,\text{g/L} \end{aligned}

Final Answer: 2.70 g/L

Check: at STP, argon’s density would be 1.78 g/L. Here the pressure is higher and the temperature only a little higher, so the gas is denser. It is.

  1. Temperature42.0°C42.0\,\text{°C}
  2. +273.15+ 273.15Step 1: to kelvins
  3. Temperature in KT=315.15KT = 315.15\,\text{K}
  4. d=PMRTd = \dfrac{PM}{RT}Step 2: P 1.75 atm, M 39.95 g/mol
  5. Density of Ard≈2.703g/L≈2.70g/Ld \approx 2.703\,\text{g/L} \approx 2.70\,\text{g/L}
Figure 9. Worked Example 3: temperature in K, then the density form of the ideal gas law.

Your turn: the density of a gas

Same steps as Worked Example 3: temperature to K, the RR that matches the pressure unit, then d=PMRTd = \frac{PM}{RT}.

Loading the practice problem…

Worked Example 4: Identifying an Unknown Gas

Problem: A 0.655 g sample of an unknown gas fills a 255 mL flask at 98.6 kPa and 22.5 °C. Find its molar mass, in g/mol. The gas is one of C4H10, SO2, Cl2 or Kr.

Step 1. Convert the temperature to K and the volume to L.

T=(22.5+273.15)K=295.65KV=255mL×1L1000mL=0.255L\begin{aligned} T &= (22.5 + 273.15)\,\text{K} = 295.65\,\text{K} \\ V &= 255\,\text{mL} \times \dfrac{1\,\text{L}}{1000\,\text{mL}} = 0.255\,\text{L} \end{aligned}

Step 2. Find the moles from PV=nRTPV = nRT. The pressure is in kPa, so use R=8.314L·kPa/(mol·K)R = 8.314\,\text{L·kPa/(mol·K)}.

n=PVRT=(98.6kPa)(0.255L)(8.314L·kPa/(mol·K))(295.65K)≈0.01023mol\begin{aligned} n &= \dfrac{PV}{RT} = \dfrac{(98.6\,\text{kPa})(0.255\,\text{L})}{(8.314\,\text{L·kPa/(mol·K)})(295.65\,\text{K})} \\ &\approx 0.01023\,\text{mol} \end{aligned}

Step 3. Divide the mass by the moles.

M=mn=0.655g0.01023mol≈64.03g/mol≈64.0g/mol\begin{aligned} M &= \dfrac{m}{n} = \dfrac{0.655\,\text{g}}{0.01023\,\text{mol}} \\ &\approx 64.03\,\text{g/mol} \approx 64.0\,\text{g/mol} \end{aligned}

Final Answer: 64.0 g/mol: the gas is sulfur dioxide, SO2

The moles, 0.01023 mol, are rounded to 4 significant figures; the unrounded value gives the same answer. Of the four choices, SO2 (64.06 g/mol) is the only one within 1% of 64.0 g/mol; C4H10 (58.12) and Cl2 (70.90) are far off.

  1. Data255mL, 22.5°C255\,\text{mL},\ 22.5\,\text{°C}
  2. +273.15+ 273.15Step 1: mL to L, °C to K
  3. Consistent unitsT=295.65K, V=0.255LT = 295.65\,\text{K},\ V = 0.255\,\text{L}
  4. n=PVRTn = \dfrac{PV}{RT}Step 2: R 8.314 for kPa
  5. Moles of gasn≈0.01023moln \approx 0.01023\,\text{mol}
  6. 0.655gn\dfrac{0.655\,\text{g}}{n}Step 3: grams over moles
  7. Molar massM≈64.03g/mol≈64.0g/molM \approx 64.03\,\text{g/mol} \approx 64.0\,\text{g/mol}SO₂
Figure 10. Worked Example 4: consistent units, moles from PV=nRTPV = nRT, then grams over moles identifies the gas.

Your turn: the molar mass of an unknown gas

Same three steps as Worked Example 4: K and L, moles from PV=nRTPV = nRT, then grams divided by moles.

Loading the practice problem…

Common Mistakes

Throughout, keep 4 significant figures in intermediate values and round only the final answer to 3.

Common mistake: Using the Celsius temperature. In Worked Example 1, putting 26.5 instead of 299.65 into PV=nRTPV = nRT gives 0.943 L, more than ten times too small. Always add 273.15 first.

Common mistake: Using units that do not match R. Every RR contains L and K and one pressure unit, so the data must use the same units. In Worked Example 1, using 745 torr with R=0.08206L·atm/(mol·K)R = 0.08206\,\text{L·atm/(mol·K)} gives 0.0140 L, about 760 times too small; convert to atm first, or use R=62.36L·torr/(mol·K)R = 62.36\,\text{L·torr/(mol·K)}. In Worked Example 4, using 0.08206 with the pressure in kPa gives 0.632 g/mol, about 100 times too small, and using 255 instead of 0.255 L gives 0.0640 g/mol, 1000 times too small.

Common mistake: Mixing up grams and moles. When a question asks for a mass, PV=nRTPV = nRT gives only the moles: multiply by the molar mass to get grams. Molar mass is M=mnM = \frac{m}{n}, in g/mol; in Worked Example 4, 0.01023 mol divided by 0.655 g is mol/g, the inverse.

Common mistake: Misusing the molar volume. The molar volume is the volume of 1 mol, so it multiplies moles, not grams. In Worked Example 2, 12.8 g times 22.414 L/mol gives 287 L, and dividing 0.2908 mol by 22.414 gives 0.0130 L. Convert the mass to moles first, then multiply: each mole occupies 22.414 L.

Common mistake: Turning the density formula upside down. In Worked Example 3, RTPM\frac{RT}{PM} gives 0.370, which has the units L/g, not g/L. Density has PP and MM on top.

Common mistake: Using 22.414 L/mol away from STP. In Worked Example 3, dividing 39.95 g/mol by 22.414 L/mol gives 1.78 g/L, the density at STP, not at 1.75 atm and 42.0 °C. The molar volume shortcut holds only at STP.

Key Takeaway

The ideal gas law PV=nRTPV = nRT links the pressure, volume, temperature and amount of a gas. Use TT in K, VV in L, and the RR that matches your pressure unit. At STP (273.15 K and 1 atm) one mole occupies 22.414 L. The density of a gas is d=PMRTd = \frac{PM}{RT}, and a molar mass is the mass divided by the moles found from PV=nRTPV = nRT.

Practice: randomized problems

Each problem below uses fresh numbers every time and mixes every kind of problem in this lesson: work it out, check your answer, then open the worked solution to compare your steps.

Loading the practice problem…

Your results

This summary collects every practice problem you try on this page and suggests what to review next.

Loading your results…

Figures and simulator: original work by Dr. Ray’s Learning Center, licensed CC BY 4.0. Data: Whitten, Davis, Peck and Stanley, Chemistry, 9th ed. (Brooks/Cole, Cengage Learning, 2010), Section 12-3 (pp. 403 to 405) for pressure and its units; Section 12-6 (p. 411) for standard temperature and pressure; Section 12-8 (pp. 413 to 414) for the standard molar volume; Sections 12-9 and 12-10 (pp. 414 to 419) for the ideal gas law, gas density and molar mass. Gas constant: R = NAk from the 2019 SI defining constants (CODATA 2022, NIST). Molar masses: IUPAC 2021 standard atomic weights (CIAAW). The simulator and the practice problems are audited; see the lesson audit log.