Calculate gas density from molecular weight (molar mass) at STP or your own pressure and temperature, or work back from density to molar mass.

Molecular weight of the gas, e.g. 28.01 for N₂. Liquid or solid density can’t be found from molar mass alone.

Prefilled with standard pressure, 1 atm. Use absolute pressure, not gauge.

Prefilled with standard temperature, 0 °C (STP). Change it for other conditions.

Optional settings
Default 1: ideal gas. Use a known factor for the same gas, pressure and temperature.

Calculator Functions

FunctionWhat it doesWhat it requires
Gas densityFinds the density of a gas from its molecular weight at a set pressure and temperatureRequires the molar mass, the absolute gas pressure, the gas temperature and a result density unit
Molar massFinds the molecular weight of a gas from its measured densityRequires the gas density, the absolute gas pressure, the gas temperature and a result molar mass unit
Absolute gas pressureFinds the pressure at which a gas has a given densityRequires the gas density, the molar mass, the gas temperature and a result pressure unit
Gas temperatureFinds the temperature at which a gas has a given densityRequires the gas density, the molar mass, the absolute gas pressure and a result temperature unit

Pressure starts at 1 atm and temperature at 0 °C, which is standard temperature and pressure (STP). Molar mass goes in as g/mol or kg/mol, density as kg/m³, g/L, g/m³ or lb/ft³, pressure as atm, Pa, kPa, bar, psi or mmHg, and temperature as °C, K or °F. An optional compressibility factor Z, 1 unless changed, adjusts the result for a real gas. Every function also reports the molar density, the number density, the specific gravity against air and the vapour density against hydrogen.

Molecular Weight to Density Formulas

ρ = P × M ÷ (Z × R × T) [1]
ρGas density (kg/m³)
PAbsolute pressure (Pa)
MMolar mass, the molecular weight in kg/mol
ZCompressibility factor, 1 for an ideal gas
RMolar gas constant, 8.314462618 J/(mol·K) [2]
TAbsolute temperature (K)

This is the ideal gas law written with density. The gas constant for one particular gas is the universal constant divided by the gas's mass per mole, which turns P × V = n × R × T into P = ρ × (R ÷ M) × T [1]. Molecular weight sets the density of a gas only. The density of a liquid or a solid cannot be found from its molecular weight, because it depends on how tightly the molecules pack.

Gas density

The main formula applies directly. Nitrogen, at 28.01 g/mol, at 1 atm and 0 °C has a density of 101,325 × 0.02801 ÷ (8.314462618 × 273.15) = 1.2497 kg/m³, which is also 1.2497 g/L. At the same pressure and temperature, density rises in direct proportion to molecular weight.

Molar mass

M = ρ × Z × R × T ÷ P

A gas with a density of 1.964 kg/m³ at 1 atm and 0 °C has a molar mass of 1.964 × 8.314462618 × 273.15 ÷ 101,325 = 0.04402 kg/mol, or 44.02 g/mol, close to carbon dioxide.

Absolute gas pressure

P = ρ × Z × R × T ÷ M

The result is absolute pressure, not gauge pressure. Carbon dioxide, at 44.01 g/mol, with a density of 1.977 kg/m³ at 25 °C is at 1.977 × 8.314462618 × 298.15 ÷ 0.04401 = 111,359 Pa, or 1.099 atm.

Gas temperature

T = P × M ÷ (ρ × Z × R)

The formula gives kelvin, and the calculator converts to °C or °F. Air, taken as 28.97 g/mol, has a density of 1.2 kg/m³ at 1 atm when its temperature is 101,325 × 0.02897 ÷ (1.2 × 8.314462618) = 294.2 K, or 21.05 °C.

Other outputs

n ÷ V = P ÷ (Z × R × T)

This is the molar density in mol/m³. Multiplying it by the Avogadro constant, 6.02214076 × 10²³ per mole [3], gives the number of molecules per cubic metre. Specific gravity is the molar mass divided by 28.9647 g/mol, the value used for air, and vapour density is the molar mass divided by 2.016 g/mol for hydrogen. Both compare gases at the same temperature and pressure.

Limits of This Estimate

  • The equation applies to an ideal gas, or a real gas that behaves like one [1]. At high pressure or near the point where the gas condenses, the result with Z = 1 drifts from the measured density.
  • The calculator does not predict Z or check that the substance is still a gas at the stated conditions. A Z value has to come from data for the same gas, pressure and temperature.
  • The Z correction and the molar masses used for air and hydrogen are general reference values. These estimates are based on the best available data and estimations.
  • A gas mixture needs its average molar mass, and gauge pressure has to be converted to absolute pressure first.

Sources

  1. NASA Glenn Research Center, Equation of State: ideal gas law with density, the gas constant divided by mass per mole, and where the law applies
  2. NIST, CODATA Value: molar gas constant: value of R
  3. NIST, CODATA Value: Avogadro constant: value used for number density