molecalculator

Moles & Molar Mass

Ideal Gas Density Equation: ρ = PM/RT

Calculator No. 01-10960 · Updated · Formula and assumptions shown below

The calculator on this page is switched off while it is checked. The formula is below, and the worked example shows how to do the sum by hand.

For study and lab planning. The result follows from the numbers you enter and the formula shown. Check it against your method before you weigh, mix or dilute anything, follow the safety data sheet and your supervisor, and do not use it for clinical, dosing or medication work.

The density of an ideal gas is calculated with the equation ρ = PM/RT, where ρ is density, P is absolute pressure, M is molar mass, R is the ideal gas constant, and T is absolute temperature. You enter pressure, molar mass, and temperature, and the calculator returns the gas density in kg/m³ (or g/L).

Formula

The ideal gas law is PV = nRT. To get density, replace n (moles) with mass/molar mass (m/M) and rearrange:

ρ = m/V = PM/RT

  • ρ = gas density (kg/m³ when using SI units, or g/L when using kPa, g/mol, K)
  • P = absolute pressure (Pa in SI, or kPa if you adjust R)
  • M = molar mass of the gas (kg/mol in SI, or g/mol if using kPa and g/L)
  • R = ideal gas constant = 8.31446261815324 J/(mol·K) (or 0.0820574 L·atm/(mol·K))
  • T = absolute temperature (K = °C + 273.15)

The calculator above uses kPa for pressure, g/mol for molar mass, and °C for temperature, so the units work out directly to kg/m³ and g/L.

Worked Example

Using the default values: P = 101.325 kPa (1 atm), M = 28.97 g/mol (air), T = 25 °C.

  1. Convert pressure to Pa: 101.325 kPa × 1000 = 101325 Pa
  2. Convert molar mass to kg/mol: 28.97 g/mol ÷ 1000 = 0.02897 kg/mol
  3. Convert temperature to K: 25 + 273.15 = 298.15 K
  4. Apply the formula: ρ = (101325 × 0.02897) / (8.31446261815324 × 298.15)
  5. Numerator: 101325 × 0.02897 = 2935.4
  6. Denominator: 8.31446261815324 × 298.15 = 2478.9
  7. ρ = 2935.4 / 2478.9 ≈ 1.184 kg/m³

The calculator gives 1.184 kg/m³, which equals 1.184 g/L. This matches the known density of dry air at 25 °C and 1 atm.

Assumptions

  • The gas behaves ideally (no intermolecular forces, molecules occupy negligible volume).
  • Pressure is absolute, not gauge pressure.
  • Temperature is absolute (Kelvin).
  • The gas is pure or has the given average molar mass (for mixtures like air).

How to Use the Density Equation

You need three inputs: pressure, molar mass, and temperature. The equation works for any gas, but you must know its molar mass. For a pure gas, use the periodic table. For a mixture, calculate the average molar mass from the mole fractions.

Steps:

  1. Determine the absolute pressure in kPa (or atm, but convert to kPa for this calculator).
  2. Find the molar mass in g/mol (e.g., O₂ = 32.00, CO₂ = 44.01, air ≈ 28.97).
  3. Measure or choose the temperature in °C.
  4. Read the density in kg/m³ or g/L.

For example, to find the density of carbon dioxide at 2 atm and 50 °C: enter P = 202.65 kPa, M = 44.01 g/mol, T = 50 °C. The calculator gives about 3.34 kg/m³.

Common Mistakes and Misconceptions

  • Using gauge pressure instead of absolute: Gauge pressure reads zero at atmospheric pressure. Always add atmospheric pressure (101.325 kPa) to gauge pressure.
  • Forgetting to convert °C to K: Temperature must be in Kelvin. Adding 273.15 is essential.
  • Mixing unit systems: If you use R = 0.0821 L·atm/(mol·K), you must use pressure in atm, volume in L, and molar mass in g/mol to get density in g/L. The calculator here uses a consistent set.
  • Assuming all gases have the same density: Heavier molecules (higher M) give higher density at the same P and T.
  • Thinking density is constant: Density changes with pressure and temperature. Hot air is less dense than cold air, which is why hot-air balloons rise.

Real-World Applications

This equation is used in meteorology to estimate air density, in engineering to design gas pipelines, in chemistry to determine molar mass from density measurements, and in scuba diving to calculate breathing gas density. It also explains why helium balloons float (helium has a much lower M than air).

For example, at standard conditions (0 °C, 1 atm), the density of oxygen (M = 32.00) is about 1.43 g/L, while hydrogen (M = 2.016) is only about 0.090 g/L.

Limitations of the Ideal Gas Model

The ideal gas law works well at low pressures and high temperatures, where gas molecules are far apart. At high pressures (e.g., >10 atm) or near the condensation point, real gases deviate. The van der Waals equation adds correction factors for molecular volume and attraction:

(P + a(n/V)²)(V – nb) = nRT

where a and b are substance-specific constants. For most engineering calculations at moderate conditions, the ideal gas equation is accurate to within a few percent.

Frequently Asked Questions

What is the density of air at room temperature?

At 25 °C (298.15 K) and 1 atm (101.325 kPa), dry air has a density of about 1.184 kg/m³ (1.184 g/L). This is what the calculator returns with M = 28.97 g/mol.

How do I find the molar mass of a gas from its density?

Rearrange the equation to M = ρRT/P. Measure the density (mass/volume) at known pressure and temperature, then plug in. This is a common experimental method for determining molecular weights of unknown gases.

Does the equation work for gas mixtures?

Yes, if you use the average molar mass of the mixture. For air, that average is about 28.97 g/mol. For a mixture of 80% N₂ (28) and 20% O₂ (32), the average is 0.8×28 + 0.2×32 = 28.8 g/mol.

What units should I use for R?

The value of R depends on your other units. With pressure in kPa, volume in L, and temperature in K, R = 8.314 kPa·L/(mol·K). With pressure in atm and volume in L, R = 0.0820574 L·atm/(mol·K). The calculator uses the SI value 8.31446261815324 J/(mol·K) and converts pressure to Pa internally.

Why does hot air rise?

Because density decreases with temperature. At constant pressure, if T increases, ρ decreases (since ρ = PM/RT). Hot air is less dense than the cooler surrounding air, so buoyancy pushes it upward.

Can I use this for water vapor?

Yes, for water vapor (M = 18.015 g/mol) at temperatures well above its boiling point. At 100 °C and 1 atm, the density is about 0.597 kg/m³. Near saturation, real-gas effects become significant.

Related

Formula used
in p | Pressure | kPa | 101.325 | 0.001 | 100000
in mm | Molar mass | g/mol | 28.97 | 0.001 | 1000
in t | Temperature | °C | 25 | -273.15 | 3000
out rho | Density | kg/m³ | (p * 1000) * (mm / 1000) / (8.31446261815324 * (t + 273.15)) | 3
out rho_gL | Density in g/L | g/L | rho * 1.0 | 3

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation with the constants and conversion factors written on the page, rounded as each result states. See method and constants, the disclaimer or report an error.

More in this section

The whole Moles & Molar Mass section →