My Calculator

Gas Density & Molar Mass Calculator

Calculate gas density from molar mass, or work out an unknown gas's molar mass from a measured density, using ρ = PM/RT. Quick-fill STP/NTP conditions, compare against common gases, and see every calculation step.

Molar mass43.9643 g/mol
Closest common gasCarbon dioxide (CO₂) (44.01 g/mol)
Temperature (K)298.15 K
Pressure (atm)1 atm
Density (g/L)1.797 g/L
Density relative to air1.518 × air

Gas Density Diagram: Floats or Sinks in Air?

The gas balloon's height shows whether it is lighter or heavier than air at these conditions, based on ρ = PM/RT.

air levelAirThis gasGAS STATEρ = 1.797 g/LM = 43.964 g/molP = 1 atmT = 298.15 K1.518 × air

Step-by-Step Solution

Here's exactly how this answer was calculated, one step at a time.

Given: P = 1 atm, T = 298.15 K, M = 44.009 g/mol, ρ = 1.797 g/L

  1. Step 1: Convert temperature to kelvin

    Gas density calculations always use absolute temperature in kelvin, so °C and °F are converted first.

    T = 25 °C → 298.15 K
  2. Step 2: Write the gas density relationship

    This comes directly from combining PV = nRT with density ρ = mass/volume and molar mass M = mass/moles.

    ρ = PM / RT
  3. Step 3: Rearrange for the unknown

    M = ρRT / P
  4. Step 4: Substitute and calculate

    R is the universal gas constant, 0.082057 L·atm/(mol·K), which matches pressure in atmospheres, density in g/L, and molar mass in g/mol.

    M = (1.797 × 0.08206 × 298.15) ÷ 1 = 43.9643 g/mol
  5. Step 5: Convert to your chosen unit

    The raw answer is converted back into whichever unit you selected.

    Result = 43.9643 g/mol

The gas density / molar mass result is:

43.9643 g/mol

Free Gas Density & Molar Mass Calculator

This calculator uses ρ = PM/RT — the gas density equation derived directly from the ideal gas law — to find the density of a gas from its molar mass, or, run the other way, to find the molar mass of an unknown gas from a density you measured in the lab. Choose what you're solving for, enter pressure and temperature, and let the calculator handle the algebra and unit conversions while showing every step.

Working out molar mass from a measured gas density is a classic identification technique: weigh a known volume of an unknown gas at a known pressure and temperature, calculate its density, then use ρ = PM/RT to back out its molar mass and compare that number against common gases to figure out what it probably is.

The Gas Density Formula: ρ = PM / RT

Gas density comes from combining the ideal gas law PV = nRT with two simple definitions: density ρ = mass ÷ volume, and molar mass M = mass ÷ moles. Substituting mass = nM into PV = nRT and rearranging for mass/volume gives ρ = PM/RT, where P is pressure, M is molar mass, R is the gas constant, and T is absolute temperature in kelvin.

This calculator uses R = 0.0821 L·atm/(mol·K) internally, which pairs pressure in atmospheres with density in g/L, but you can enter your numbers in kPa, mmHg, bar, psi, kg/m³, g/cm³, or lb/ft³ — the unit dropdowns handle the conversion for you automatically.

Finding Molar Mass from a Measured Density

Rearranged for molar mass, the formula becomes M = ρRT/P. This is the direction most often used in a real chemistry lab: you can measure the mass of a known volume of gas fairly easily with a flask and a balance, work out its density, and then use this rearrangement to find molar mass without ever counting moles directly.

Once you have a molar mass, you can compare it against the molar masses of common gases to make an educated guess at the gas's identity — this calculator does that automatically and flags the closest match among 18 common gases whenever you solve for molar mass.

Worked Example: Identifying an Unknown Gas

Suppose a flask of unknown gas has a measured density of 1.797 g/L at 25°C and 1 atm. Using M = ρRT/P: M = (1.797 × 0.0821 × 298.15) ÷ 1 ≈ 44.0 g/mol. Checking common gases, 44.0 g/mol matches carbon dioxide almost exactly, so the unknown gas is very likely CO₂.

This same substitution-and-compare approach works for any gas density measurement, whether it comes from a textbook problem, a lab vapor density experiment, or a real-world density reading you're trying to make sense of.

Gas Density Depends on Pressure and Temperature

Unlike the density of a solid or liquid, gas density changes noticeably with both pressure and temperature, because gases are highly compressible. Raising the pressure squeezes the same mass of gas into a smaller volume, raising density; raising the temperature does the opposite, expanding the gas and lowering its density.

This is why gas density figures are always quoted alongside a temperature and pressure — 1.977 g/L for CO₂ specifically means at STP, not under arbitrary conditions. Use the STP, IUPAC STP, NTP, and SATP quick-fill buttons above to check how much a gas's density shifts between standard reference conditions.

Density Relative to Air: Will a Gas Float or Sink?

This calculator also compares your gas's density to the density of dry air (molar mass ≈ 28.97 g/mol) at the same temperature and pressure. A ratio below 1 means the gas is less dense than air and will rise — helium (M ≈ 4 g/mol) and hydrogen (M ≈ 2 g/mol) are the classic lighter-than-air examples used in balloons. A ratio above 1 means the gas sinks in still air, which is why heavier gases like carbon dioxide or propane can pool near the floor of a poorly ventilated room.

This relative density comparison is exactly why CO₂ fire extinguishers work by smothering: the gas is denser than air, so it sinks and displaces oxygen at ground level around a fire.

Gas Density, Molar Mass & Real Gas Behaviour

Like the rest of the ideal gas law family, ρ = PM/RT assumes an ideal gas — negligible molecular volume and no intermolecular attraction. This approximation is very good at low pressure and high temperature, which covers most classroom and everyday laboratory conditions.

At high pressure or low temperature, especially close to the point where a gas would condense, real gas density deviates from this formula, and a real-gas equation like Van der Waals gives a more accurate result. This calculator is intended for educational and general estimation use, not for safety-critical pressurized gas engineering.

Gas Density Calculator: Quick Reference

ρ = PM/RT for density, M = ρRT/P for molar mass, P = ρRT/M for pressure, and T = PM/(ρR) for temperature. Always convert temperature to kelvin first, and keep pressure, density, and molar mass in units consistent with the gas constant you're using (atm, g/L, and g/mol pair with R = 0.0821 L·atm/(mol·K)).

This formula is one of the fastest ways to sanity-check an unknown gas sample, compare relative buoyancy of different gases, or connect a lab measurement directly to a molecular identity without ever weighing out a mole of material.

Frequently Asked Questions

What is the formula for gas density?

ρ = PM/RT, where P is pressure, M is molar mass, R is the gas constant, and T is absolute temperature in kelvin.

How do you find molar mass from gas density?

Rearrange the density formula: M = ρRT/P. Measure the gas density at a known pressure and temperature, then substitute the values in.

Why does gas density depend on temperature and pressure?

Gases are compressible, so the same mass of gas occupies a different volume — and therefore has a different density — depending on how squeezed (pressure) or expanded (temperature) it is.

What is the molar mass of air?

Dry air is a mixture, but it behaves like a gas with an average molar mass of about 28.97 g/mol, which this calculator uses for the relative-density comparison.

How can gas density identify an unknown gas?

Measure the density of an unknown gas sample at a known temperature and pressure, calculate its molar mass with M = ρRT/P, then compare that number against known gases to find the closest match.

Why do helium balloons float?

Helium has a molar mass of about 4 g/mol, far lower than air's 28.97 g/mol, so a helium-filled balloon is much less dense than the surrounding air and rises.

Is gas density the same as vapor density?

Vapor density is usually reported relative to hydrogen or air rather than in g/L, but it uses the same underlying physics — this calculator's 'density relative to air' result is one common form of vapor density.

Does this formula work for all gases?

It's an excellent approximation for most gases at everyday pressure and temperature. Near condensation or at high pressure, real gases deviate and a real-gas equation like Van der Waals is more accurate.