How to Calculate the Density of a Gas

cannisters of gas
Ben Edwards/Getty Images

If the molecular mass of a gas is known, the ideal gas law can be manipulated to find the density of the gas. It's just a matter of plugging in the right variables and performing a few calculations.

Key Takeaways: How to Calculate Gas Density

  • Density is defined as mass per unit volume.
  • If you happen to know how much gas you have and its volume, the calculation is easy. Usually, you only have implied information and need to use the ideal gas law to find the missing bits.
  • The ideal gas law is PV = nRT, so if you know enough values, you can calculate volume (V) or the number of moles (n). Sometimes you then have to convert number of moles to grams.
  • The ideal gas law may be used to approximate the behavior of real gases, but there is always a bit of error in the result.

How to Calculate Gas Density

What is the density of a gas with molar mass 100 g/mol at 0.5 atm and 27 degrees Celsius?

Before you begin, keep in mind what you're looking for as an answer in terms of units. Density is defined as mass per unit volume, which can be expressed in terms of grams per liter or grams per milliliter. You may need to do unit conversions. Keep on the lookout for unit mismatches when you plug values into equations.

First, start with the ideal gas law:

PV = nRT

where P = pressure, V = volume, n = number of moles of gas, R = gas constant = 0.0821 L·atm/mol·K, and T = absolute temperature (in Kelvin).

Examine the units of R carefully. This is where many people get into trouble. You'll get an incorrect answer if you enter a temperature in Celsius or pressure in Pascals, etc. Always use atmosphere for pressure, liters for volume, and Kelvin for temperature.

To find the density of the gas, you need to know the mass of the gas and the volume. First, find the volume. Here is the ideal gas law equation rearranged to solve for V:

V = nRT/P

After you have found the volume, you must find the mass. The number of moles is the place to start. The number of moles is the mass (m) of the gas divided by its molecular mass (MM):

n = m/MM

Substitute this mass value into the volume equation in place of n:

V = mRT/MM·P

Density (ρ) is mass per volume. Divide both sides by m:

V/m = RT/MM·P

Then invert the equation:

m/V = MM·P/RT
ρ = MM·P/RT

Now you have the ideal gas law rewritten in a form you can use with the information you were given. To find the density of the gas, just plug in the values of the known variables. Remember to use absolute temperature for T:

27 degrees Celsius + 273 = 300 Kelvin
ρ = (100 g/mol)(0.5 atm)/(0.0821 L·atm/mol·K)(300 K) ρ = 2.03 g/L

The density of the gas is 2.03 g/L at 0.5 atm and 27 degrees Celsius.

How to Decide If You Have a Real Gas

The ideal gas law is written for ideal or perfect gases. You can use values for real gases so long as they act like ideal gases. To use the formula for a real gas, it must be at low pressure and low temperature. Increasing pressure or temperature raises the kinetic energy of the gas and forces the molecules to interact. While the ideal gas law can still offer an approximation under these conditions, it becomes less accurate when molecules are close together and excited.