Gas Density and Molar Mass With the Ideal Gas Law

Rearrange PV = nRT to find a gas's density (d = PM/RT) or identify an unknown gas from its molar mass (M = dRT/P). Derivations and worked examples.

Gas Density and Molar Mass With the Ideal Gas Law

You need the density of a gas or its molar mass, but you only have pressure, temperature, and maybe a mass measurement. The gas density formula, d = PM/RT, gets you both from the ideal gas law without extra steps. PV = nRT is the core relationship, but it asks for moles, which you rarely have directly. The density form skips that: d = PM/RT gives density in grams per liter when you know the molar mass, and rearranged it gives molar mass when you know the density.

Deriving d = PM/RT From PV = nRT

Start With What You Know

You have PV = nRT. Density is mass per volume, d = m/V. Molar mass M is mass per mole, M = m/n, so n = m/M. Substitute n into the ideal gas law: PV = (m/M)RT. Solve for m/V: m/V = PM/RT, which is d = PM/RT. No new constants, just algebra. The molar gas constant R you use must match the units of P, V, and T. For pressure in atm and volume in L, use R = 0.082057 L·atm/(mol·K). For pressure in mmHg, use 62.3637 L·mmHg/(mol·K). The wrong R produces a number that looks right but is physically meaningless, as OpenStax Chemistry 2e (sections 9.2-9.3) emphasizes.

Check Your Units Before You Calculate

Density from this formula comes out in g/L if M is in g/mol, P in atm, T in K, and R in L·atm/(mol·K). A common failure: using R = 8.314 J/(mol·K) while P is in atm. That mismatches by a factor of 101.3. Always confirm the R value against the pressure and volume units. The combined gas law (P₁V₁/T₁ = P₂V₂/T₂) is a shortcut for constant n, but the d = PM/RT form works for any single set of conditions without needing a second state.

Finding Molar Mass From Density

When you have the density of a gas at known T and P, you can find its molar mass. Rearrange d = PM/RT to M = dRT/P. This method is direct but sensitive: a 0.1 g error in a 1 g sample produces a 10% error in M. You must tare the container and use the mass of the gas alone. Convert temperature to Kelvin and pressure to the same units as your R value. The technique works best for gases well above their boiling point. For water vapor at 273.15 K and 1 atm, the gas density formula gives a number, but the physical state is wrong, water at those conditions is ice or liquid, not gas. Check the boiling point before applying the formula.

Worked Examples: Density and Molar Mass

Example 1: Density of Nitrogen at STP

Find the density of N₂ at 273.15 K and 1 atm. M for N₂ = 28.02 g/mol. Use R = 0.082057 L·atm/(mol·K). d = (1 atm × 28.02 g/mol) / (0.082057 × 273.15 K) = 28.02 / 22.414 = 1.250 g/L. This matches the known density of nitrogen at old STP (1 atm). At IUPAC STP (1 bar), use R = 8.314 × 10⁻² L·bar/(mol·K) and get d = (1 bar × 28.02) / (0.08314 × 273.15) = 28.02 / 22.710 = 1.234 g/L. The difference is 1.3%, which matters if you are comparing lab results to literature values.

Example 2: Molar Mass From Measured Density

A gas sample has density 1.96 g/L at 298 K and 0.980 atm. Find M. M = dRT/P = (1.96 × 0.082057 × 298) / 0.980 = (1.96 × 24.45) / 0.980 = 47.92 / 0.980 = 48.9 g/mol. This is close to ozone (48.0 g/mol) or SO₂ (64.1 g/mol), check by other means. The 0.1 g error in density measurement gives about a 5% uncertainty in M, so do not trust a single measurement for identification.

Example 3: Density of CO₂ at Room Temperature

Find the density of CO₂ at 298 K and 1 atm. M = 44.01 g/mol. d = (1 × 44.01) / (0.082057 × 298) = 44.01 / 24.45 = 1.80 g/L. The real density of CO₂ at these conditions is about 1.84 g/L, 2% higher. The ideal gas law ignores intermolecular attraction and molecular volume, both of which increase density. For higher accuracy near the boiling point, use van der Waals constants: for CO₂, a = 3.59 L²·atm/mol² and b = 0.0427 L/mol (from OpenStax Chemistry 2e, section 9.6). The van der Waals equation corrects for these effects.

Why Hot Air Rises: Density vs Temperature

From d = PM/RT, density is inversely proportional to temperature at constant pressure and molar mass.The cooler surrounding air is denser, so it sinks beneath the warm air, pushing it upward. This is buoyancy. The ideal gas law explains why a hot air balloon rises and why a house loses heat through the ceiling, warm air expands, becomes less dense than the cold air outside, and rises. At pressures above about 5 atm, the density-temperature relationship becomes non-linear for real gases, and the ideal gas law overestimates the density change. For most everyday applications below 5 atm, d = PM/RT is accurate enough.

Common Questions

What is the gas density formula?

d = PM/RT, derived from PV = nRT. It gives density in g/L when P is in atm, M in g/mol, T in K, and R = 0.082057 L·atm/(mol·K).

How do I find molar mass from density?

Rearrange d = PM/RT to M = dRT/P. Use the same units. A 0.1 g error in mass produces about a 10% error in M for a 1 g sample, so tare carefully.

Which R value should I use?

Match R to your pressure and volume units. For atm and L use 0.082057. For mmHg use 62.3637. For bar use 0.08314. The wrong R gives a meaningless number.

Does d = PM/RT work for all gases?

No. It works well above 1.5 times the boiling point and below about 5 atm. For gases near condensation, use the van der Waals equation. Water vapor at STP is below its boiling point, so the formula fails.