Skip to main content
Chemistry LibreTexts

5.3: The Ideal Gas Law

Skills to Develop

  • To use the ideal gas law to describe the behavior of a gas.

In this module, the relationship between Pressure, Temperature, Volume, and Amount of a gas are described and how these relationships can be combined to give a general expression that describes the behavior of a gas.

Deriving the Ideal Gas Law

Any set of relationships between a single quantity (such as V) and several other variables (\(P\), \(T\), and \(n\)) can be combined into a single expression that describes all the relationships simultaneously. The three individual expressions are as follows:

  • Boyle’s law

\[V \propto \dfrac{1}{P} \;\; \text{@ constant n and T}\]

  • Charles’s law

\[V \propto T \;\; \text{@ constant n and P}\]

  • Avogadro’s law

\[V \propto n \;\; \text{@ constant T and P}\]

Combining these three expressions gives

\[V \propto \dfrac{nT}{P} \tag{6.3.1}\]

which shows that the volume of a gas is proportional to the number of moles and the temperature and inversely proportional to the pressure. This expression can also be written as

\[V= {\rm Cons.} \left( \dfrac{nT}{P} \right) \tag{6.3.2}\]

By convention, the proportionality constant in Equation 6.3.1 is called the gas constant, which is represented by the letter \(R\). Inserting R into Equation 6.3.2 gives

\[ V = \dfrac{Rnt}{P} = \dfrac{nRT}{P} \tag{6.3.3}\]

Clearing the fractions by multiplying both sides of Equation 6.3.4 by \(P\) gives

\[PV = nRT \tag{6.3.4}\]

This equation is known as the ideal gas law.

An ideal gas is defined as a hypothetical gaseous substance whose behavior is independent of attractive and repulsive forces and can be completely described by the ideal gas law. In reality, there is no such thing as an ideal gas, but an ideal gas is a useful conceptual model that allows us to understand how gases respond to changing conditions. As we shall see, under many conditions, most real gases exhibit behavior that closely approximates that of an ideal gas. The ideal gas law can therefore be used to predict the behavior of real gases under most conditions. The ideal gas law does not work well at very low temperatures or very high pressures, where deviations from ideal behavior are most commonly observed.


Significant deviations from ideal gas behavior commonly occur at low temperatures and very high pressures.

Before we can use the ideal gas law, however, we need to know the value of the gas constant R. Its form depends on the units used for the other quantities in the expression. If V is expressed in liters (L), P in atmospheres (atm), T in kelvins (K), and n in moles (mol), then

\[R = 0.08206 \dfrac{\rm L\cdot atm}{\rm K\cdot mol} \tag{6.3.5}\]

Because the product PV has the units of energy, R can also have units of J/(K•mol):

\[R = 8.3145 \dfrac{\rm J}{\rm K\cdot mol}\tag{6.3.6}\]

Standard Conditions of Temperature and Pressure

Scientists have chosen a particular set of conditions to use as a reference: 0°C (273.15 K) and \(\rm1\; bar = 100 \;kPa = 10^5\;Pa\) pressure, referred to as standard temperature and pressure (STP).

\[\text{STP:} \hspace{2cm} T=273.15\;{\rm K}\text{ and }P=\rm 1\;bar=10^5\;Pa\]

Please note that STP was defined differently in the part. The old definition was based on a standard pressure of 1 atm.

We can calculate the volume of 1.000 mol of an ideal gas under standard conditions using the variant of the ideal gas law given in Equation 6.3.4:


Thus the volume of 1 mol of an ideal gas is 22.71 L at STP and 22.41 L at 0°C and 1 atm, approximately equivalent to the volume of three basketballs. The molar volumes of several real gases at 0°C and 1 atm​ are given in Table 10.3, which shows that the deviations from ideal gas behavior are quite small. Thus the ideal gas law does a good job of approximating the behavior of real gases at 0°C and 1 atm​. The relationships described in Section 10.3 as Boyle’s, Charles’s, and Avogadro’s laws are simply special cases of the ideal gas law in which two of the four parameters (P, V, T, and n) are held fixed.

Table 6.3.1: Molar Volumes of Selected Gases at 0°C and 1 atm
Gas Molar Volume (L)
He 22.434
Ar 22.397
H2 22.433
N2 22.402
O2 22.397
CO2 22.260
NH3 22.079

Applying the Ideal Gas Law

The ideal gas law allows us to calculate the value of the fourth variable for a gaseous sample if we know the values of any three of the four variables (P, V, T, and n). It also allows us to predict the final state of a sample of a gas (i.e., its final temperature, pressure, volume, and amount) following any changes in conditions if the parameters (P, V, T, and n) are specified for an initial state. Some applications are illustrated in the following examples. The approach used throughout is always to start with the same equation—the ideal gas law—and then determine which quantities are given and which need to be calculated. Let’s begin with simple cases in which we are given three of the four parameters needed for a complete physical description of a gaseous sample.

Example 6.3.1

The balloon that Charles used for his initial flight in 1783 was destroyed, but we can estimate that its volume was 31,150 L (1100 ft3), given the dimensions recorded at the time. If the temperature at ground level was 86°F (30°C) and the atmospheric pressure was 745 mmHg, how many moles of hydrogen gas were needed to fill the balloon?

Given: volume, temperature, and pressure

Asked for: amount of gas


  1. Solve the ideal gas law for the unknown quantity, in this case n.
  2. Make sure that all quantities are given in units that are compatible with the units of the gas constant. If necessary, convert them to the appropriate units, insert them into the equation you have derived, and then calculate the number of moles of hydrogen gas needed.


A We are given values for P, T, and V and asked to calculate n. If we solve the ideal gas law (Equation 6.3.4) for n, we obtain


B P and T are given in units that are not compatible with the units of the gas constant [R = 0.08206 (L•atm)/(K•mol)]. We must therefore convert the temperature to kelvins and the pressure to atmospheres:

\[T=273+30=303{\rm K}\]

Substituting these values into the expression we derived for n, we obtain

\[n=\dfrac{PV}{RT}=\rm\dfrac{0.980\;atm\times31150\;L}{0.08206\dfrac{atm\cdot L}{\rm mol\cdot K}\times 303\;K}=1.23\times10^3\;mol\]

Exercise 6.3.1

Suppose that an “empty” aerosol spray-paint can has a volume of 0.406 L and contains 0.025 mol of a propellant gas such as CO2. What is the pressure of the gas at 25°C?

Answer: 1.5 atm

In Example 6.3.1, we were given three of the four parameters needed to describe a gas under a particular set of conditions, and we were asked to calculate the fourth. We can also use the ideal gas law to calculate the effect of changes in any of the specified conditions on any of the other parameters, as shown in Example 6.3.5.

General Gas Equation

When a gas is described under two different conditions, the ideal gas equation must be applied twice - to an initial condition and a final condition. This is:

\[\begin{array}{cc}\text{Initial condition }(i) & \text{Final condition} (f)\\P_iV_i=n_iRT_i & P_fV_f=n_fRT_f\end{array}\]

Both equations can be rearranged to give:

\[R=\dfrac{P_iV_i}{n_iT_i} \hspace{1cm} R=\dfrac{P_fV_f}{n_fT_f}\]

The two equations are equal to each other since each is equal to the same constant \(R\). Therefore, we have:


The equation is called the general gas equation. The equation is particularly useful when one or two of the gas properties are held constant between the two conditions.  In such cases, the equation can be simplified by eliminating these constant gas properties.

Example 6.3.2

Suppose that Charles had changed his plans and carried out his initial flight not in August but on a cold day in January, when the temperature at ground level was −10°C (14°F). How large a balloon would he have needed to contain the same amount of hydrogen gas at the same pressure as in Example 6.3.1?

Given: temperature, pressure, amount, and volume in August; temperature in January

Asked for: volume in January


  1. Use the results from Example 6.3.1 for August as the initial conditions and then calculate the change in volume due to the change in temperature from 30°C to −10°C. Begin by constructing a table showing the initial and final conditions.
  2. Simplify the general gas equation by eliminating the quantities that are held constant between the initial and final conditions, in this case \(P\) and \(n\).
  3. Solve for the unknown parameter.


A To see exactly which parameters have changed and which are constant, prepare a table of the initial and final conditions:

Initial (August) Final (January)
\(T_i=30\)°C = 303 K \(T_f=\)​−10°C = 263 K
\(P_i=\)0.980 atm \(P_f=\)0.980 atm
\(n_i=\)1.23 × 103 mol  \(n_f=\)1.23 × 103 mol 
\(V_i=31150\) L \(V_f=?\)

Both \(n\) and \(P\) are the same in both cases​ (\(n_i=n_f,P_i=P_f\)). Therefore, Equation can be simplified to: 


This is the relationship first noted by Charles.

C ​Solving the equation for \(V_f\), we get:


It is important to check your answer to be sure that it makes sense, just in case you have accidentally inverted a quantity or multiplied rather than divided. In this case, the temperature of the gas decreases. Because we know that gas volume decreases with decreasing temperature, the final volume must be less than the initial volume, so the answer makes sense. We could have calculated the new volume by plugging all the given numbers into the ideal gas law, but it is generally much easier and faster to focus on only the quantities that change.

Exercise 6.3.2

At a laboratory party, a helium-filled balloon with a volume of 2.00 L at 22°C is dropped into a large container of liquid nitrogen (T = −196°C). What is the final volume of the gas in the balloon?

Answer: 0.52 L

Example 6.3.1 illustrates the relationship originally observed by Charles. We could work through similar examples illustrating the inverse relationship between pressure and volume noted by Boyle (PV = constant) and the relationship between volume and amount observed by Avogadro (V/n = constant). We will not do so, however, because it is more important to note that the historically important gas laws are only special cases of the ideal gas law in which two quantities are varied while the other two remain fixed. The method used in Example 6.3.1 can be applied in any such case, as we demonstrate in Example 6.3.2 (which also shows why heating a closed container of a gas, such as a butane lighter cartridge or an aerosol can, may cause an explosion).

Example 6.3.3

Aerosol cans are prominently labeled with a warning such as “Do not incinerate this container when empty.” Assume that you did not notice this warning and tossed the “empty” aerosol can in Exercise 5 (0.025 mol in 0.406 L, initially at 25°C and 1.5 atm internal pressure) into a fire at 750°C. What would be the pressure inside the can (if it did not explode)?

Given: initial volume, amount, temperature, and pressure; final temperature

Asked for: final pressure


Follow the strategy outlined in Example 6.3.5.


Prepare a table to determine which parameters change and which are held constant:

Initial Final
\(V_i=0.406\;\rm L\)  \(V_f=0.406\;\rm L\) 
\(n_i=0.025\;\rm mol\) \(n_f=0.025\;\rm mol\)
\(T_i=\rm25\;^\circ C=298\;K\) \(T_i=\rm750\;^\circ C=1023\;K\)
\(P_i=1.5\;\rm atm\) \(P_f=?\)

Both \(V\) and \(n\) are the same in both cases​ (\(V_i=V_f,n_i=n_f\)). Therefore, Equation can be simplified to: 


By solving the equation for \(P_f\), we get:


This pressure is more than enough to rupture a thin sheet metal container and cause an explosion!

Exercise 6.3.3

Suppose that a fire extinguisher, filled with CO2 to a pressure of 20.0 atm at 21°C at the factory, is accidentally left in the sun in a closed automobile in Tucson, Arizona, in July. The interior temperature of the car rises to 160°F (71.1°C). What is the internal pressure in the fire extinguisher?

Answer: 23.4 atm

In Example 6.3.1 and Example 6.3.2, two of the four parameters (PVT, and n) were fixed while one was allowed to vary, and we were interested in the effect on the value of the fourth. In fact, we often encounter cases where two of the variables PV, and T are allowed to vary for a given sample of gas (hence n is constant), and we are interested in the change in the value of the third under the new conditions. 

Example 6.3.4

We saw in Example 6.3.1 that Charles used a balloon with a volume of 31,150 L for his initial ascent and that the balloon contained 1.23 × 103 mol of H2 gas initially at 30°C and 745 mmHg. Suppose that Gay-Lussac had also used this balloon for his record-breaking ascent to 23,000 ft and that the pressure and temperature at that altitude were 312 mmHg and −30°C, respectively. To what volume would the balloon have had to expand to hold the same amount of hydrogen gas at the higher altitude?

Given: initial pressure, temperature, amount, and volume; final pressure and temperature

Asked for: final volume


Follow the strategy outlined in Example 6.3.5.


Begin by setting up a table of the two sets of conditions:

Initial  Final
\(P_i=745\;\rm mmHg=0.980\;atm\)  \(P_f=312\;\rm mmHg=0.411\;atm\) 
\(T_i=\rm30\;^\circ C=303\;K\) \(T_f=\rm750-30\;^\circ C=243\;K\)
\(n_i=\rm1.2\times10^3\;mol\) \(n_i=\rm1.2\times10^3\;mol\)
\(V_i=\rm31150\;L\) \(V_f=?\)


By eliminating the constant property (\(n\)) of the gas, Equation 6.3.8 is simplified to:


By solving the equation for \(V_f\), we get:


Does this answer make sense? Two opposing factors are at work in this problem: decreasing the pressure tends to increase the volume of the gas, while decreasing the temperature tends to decrease the volume of the gas. Which do we expect to predominate? The pressure drops by more than a factor of two, while the absolute temperature drops by only about 20%. Because the volume of a gas sample is directly proportional to both T and 1/P, the variable that changes the most will have the greatest effect on V. In this case, the effect of decreasing pressure predominates, and we expect the volume of the gas to increase, as we found in our calculation.

We could also have solved this problem by solving the ideal gas law for V and then substituting the relevant parameters for an altitude of 23,000 ft:

Except for a difference caused by rounding to the last significant figure, this is the same result we obtained previously. There is often more than one “right” way to solve chemical problems.

Exercise 6.3.4

A steel cylinder of compressed argon with a volume of 0.400 L was filled to a pressure of 145 atm at 10°C. At 1.00 atm pressure and 25°C, how many 15.0 mL incandescent light bulbs could be filled from this cylinder? (Hint: find the number of moles of argon in each container.)

Answer: 4.07 × 103

Using the Ideal Gas Law to Calculate Gas Densities and Molar Masses

The ideal gas law can also be used to calculate molar masses of gases from experimentally measured gas densities. To see how this is possible, we first rearrange the ideal gas law to obtain


The left side has the units of moles per unit volume (mol/L). The number of moles of a substance equals its mass (\(m\), in grams) divided by its molar mass (\(M\), in grams per mole):


Substituting this expression for \(n\) into Equation 6.3.9 gives


Because \(m/V\) is the density \(d\) of a substance, we can replace \(m/V\) by \(d\) and rearrange to give


The distance between particles in gases is large compared to the size of the particles, so their densities are much lower than the densities of liquids and solids. Consequently, gas density is usually measured in grams per liter (g/L) rather than grams per milliliter (g/mL).

Example 6.3.5

Calculate the density of butane at 25°C and a pressure of 750 mmHg.

Given: compound, temperature, and pressure

Asked for: density


  1. Calculate the molar mass of butane and convert all quantities to appropriate units for the value of the gas constant.
  2. Substitute these values into Equation 6.3.12 to obtain the density.


A The molar mass of butane (C4H10) is

\[M=(4)(12.011) + (10)(1.0079) = 58.123 \rm g/mol\]

Using 0.08206 (L•atm)/(K•mol) for R means that we need to convert the temperature from degrees Celsius to kelvins (T = 25 + 273 = 298 K) and the pressure from millimeters of mercury to atmospheres:


B Substituting these values into Equation 6.3.12 gives

\[\rho=\rm\dfrac{58.123\;g/mol\times0.987\;atm}{0.08206\dfrac{L\cdot atm}{K\cdot mol}\times298\;K}=2.35\;g/L\]

Exercise 6.3.5

Radon (Rn) is a radioactive gas formed by the decay of naturally occurring uranium in rocks such as granite. It tends to collect in the basements of houses and poses a significant health risk if present in indoor air. Many states now require that houses be tested for radon before they are sold. Calculate the density of radon at 1.00 atm pressure and 20°C and compare it with the density of nitrogen gas, which constitutes 80% of the atmosphere, under the same conditions to see why radon is found in basements rather than in attics.

Answer: radon, 9.23 g/L; N2, 1.17 g/L

A common use of Equation 6.3.12 is to determine the molar mass of an unknown gas by measuring its density at a known temperature and pressure. This method is particularly useful in identifying a gas that has been produced in a reaction, and it is not difficult to carry out. A flask or glass bulb of known volume is carefully dried, evacuated, sealed, and weighed empty. It is then filled with a sample of a gas at a known temperature and pressure and reweighed. The difference in mass between the two readings is the mass of the gas. The volume of the flask is usually determined by weighing the flask when empty and when filled with a liquid of known density such as water. The use of density measurements to calculate molar masses is illustrated in Example 6.3.6.

Example 6.3.6

The reaction of a copper penny with nitric acid results in the formation of a red-brown gaseous compound containing nitrogen and oxygen. A sample of the gas at a pressure of 727 mmHg and a temperature of 18°C weighs 0.289 g in a flask with a volume of 157.0 mL. Calculate the molar mass of the gas and suggest a reasonable chemical formula for the compound.

Given: pressure, temperature, mass, and volume

Asked for: molar mass and chemical formula


  1. Solve Equation 6.3.12 for the molar mass of the gas and then calculate the density of the gas from the information given.
  2. Convert all known quantities to the appropriate units for the gas constant being used. Substitute the known values into your equation and solve for the molar mass.
  3. Propose a reasonable empirical formula using the atomic masses of nitrogen and oxygen and the calculated molar mass of the gas.


A Solving Equation 6.3.12 for the molar mass gives


Density is the mass of the gas divided by its volume:

\[\rho=\dfrac{m}{V}=\dfrac{0.289\rm g}{0.17\rm L}=1.84 \rm g/L\]

B We must convert the other quantities to the appropriate units before inserting them into the equation:

\[T=18+273=291  K\]

\[P=727\rm mmHg\times\dfrac{1\rm atm}{760\rm mmHg}=0.957\rm atm\]

The molar mass of the unknown gas is thus

\[\rho=\rm\dfrac{1.84\;g/L\times0.08206\dfrac{L\cdot atm}{K\cdot mol}\times291\;K}{0.957\;atm}=45.9 g/mol\]

C The atomic masses of N and O are approximately 14 and 16, respectively, so we can construct a list showing the masses of possible combinations:

\[M({\rm NO})=14 + 16=30 \rm\; g/mol\]

\[M({\rm N_2O})=(2)(14)+16=44 \rm\;g/mol\]

\[M({\rm NO_2})=14+(2)(16)=46 \rm\;g/mol\]

The most likely choice is NO2 which is in agreement with the data. The red-brown color of smog also results from the presence of NO2 gas.

Exercise 6.3.6

You are in charge of interpreting the data from an unmanned space probe that has just landed on Venus and sent back a report on its atmosphere. The data are as follows: pressure, 90 atm; temperature, 557°C; density, 58 g/L. The major constituent of the atmosphere (>95%) is carbon. Calculate the molar mass of the major gas present and identify it.

Answer: 44 g/mol; \(CO_2\)


The ideal gas law is derived from empirical relationships among the pressure, the volume, the temperature, and the number of moles of a gas; it can be used to calculate any of the four properties if the other three are known.

Ideal gas equation: \(PV = nRT\),

where \(R = 0.08206 \dfrac{\rm L\cdot atm}{\rm K\cdot mol}=8.3145 \dfrac{\rm J}{\rm K\cdot mol}\)

General gas equation: \(\dfrac{P_iV_i}{n_iT_i}=\dfrac{P_fV_f}{n_fT_f}\)

Density of a gas: \(\rho=\dfrac{MP}{RT}\)

The empirical relationships among the volume, the temperature, the pressure, and the amount of a gas can be combined into the ideal gas law, PV = nRT. The proportionality constant, R, is called the gas constant and has the value 0.08206 (L•atm)/(K•mol), 8.3145 J/(K•mol), or 1.9872 cal/(K•mol), depending on the units used. The ideal gas law describes the behavior of an ideal gas, a hypothetical substance whose behavior can be explained quantitatively by the ideal gas law and the kinetic molecular theory of gases. Standard temperature and pressure (STP) is 0°C and 1 atm. The volume of 1 mol of an ideal gas at STP is 22.41 L, the standard molar volume. All of the empirical gas relationships are special cases of the ideal gas law in which two of the four parameters are held constant. The ideal gas law allows us to calculate the value of the fourth quantity (P, V, T, or n) needed to describe a gaseous sample when the others are known and also predict the value of these quantities following a change in conditions if the original conditions (values of P, V, T, and n) are known. The ideal gas law can also be used to calculate the density of a gas if its molar mass is known or, conversely, the molar mass of an unknown gas sample if its density is measured.