Molar Mass of Gas Calculator
Enter the pressure, volume, temperature, and sample mass of your gas to find its molar mass and the number of moles present. The calculator applies the ideal gas law (PV = nRT) rearranged as M = mRT / (ZPV), where Z accounts for real-gas behaviour. Switch pressure, volume, and temperature units freely - results update instantly.
Formula
Worked example
A 2.016 g sample of a gas occupies 22.414 L at 273.15 K and 1.000 atm (STP, ideal gas). Then n = (1.000 × 22.414) / (1 × 0.082057 × 273.15) = 1.000 mol, and M = 2.016 / 1.000 = 2.016 g/mol, which matches hydrogen (H2).
How to find the molar mass of a gas using the ideal gas law
The ideal gas law, PV = nRT, links the pressure (P), volume (V), amount of substance (n), the universal gas constant (R = 0.082057 L·atm/mol·K), and the absolute temperature (T) of any gas that behaves ideally. Because n = mass / molar mass, you can substitute n = m/M into the equation to get PV = (m/M)RT, which rearranges to M = mRT / (PV). This means that if you can measure (or look up) the pressure, volume, temperature, and sample mass for a gas, you can calculate its molar mass without knowing its chemical identity. The method is routinely used in the lab to identify volatile unknown compounds.
Pressure, volume and temperature units - what to use
The ideal gas constant R has a different numerical value depending on which units you choose. The most common values are R = 0.082057 L·atm/(mol·K) and R = 8.31446 L·kPa/(mol·K). This calculator converts your chosen units automatically, so you can enter pressure in kPa, bar, mmHg, torr, or psi; volume in litres, millilitres, cubic decimetres, or cubic metres; and temperature in Kelvin, Celsius, or Fahrenheit. Temperature must always be converted to Kelvin internally because negative Kelvin values are physically impossible - the calculator handles that conversion for you. Always use absolute pressure (not gauge pressure) in the calculation.
Real gases and the compressibility factor Z
The ideal gas law assumes that gas molecules have no volume and do not interact with each other. Real gases deviate from this, especially at high pressures or near their critical temperature. The compressibility factor Z corrects for this: Z = PV / (nRT). For an ideal gas Z = 1. For a real gas under high pressure, Z is often greater than 1 because repulsive forces dominate. Near the condensation point, intermolecular attractions can make Z fall below 1. The corrected formula is M = mRT / (ZPV). For most lab experiments at atmospheric pressure and room temperature, Z is very close to 1 and can be left at the default value. If you need higher accuracy, look up the Z value for your gas in a van der Waals or Nelson-Obert chart, or obtain it from NIST webbook.
Standard conditions and molar volume
At standard temperature and pressure (STP: 0°C and 1 atm) one mole of any ideal gas occupies exactly 22.414 L, the standard molar volume. At standard ambient temperature and pressure (SATP: 25°C and 100 kPa, used by IUPAC since 1982), the molar volume is 24.790 L/mol. These reference points are useful for quick checks: if your gas sample fills 22.414 L at STP and you enter the correct mass, the calculator should return the expected molar mass. If it does not, check whether your pressure is absolute or gauge and whether your temperature is in the right unit.
Molar masses of common gases
| Gas | Formula | Molar mass (g/mol) | Class |
|---|---|---|---|
| Hydrogen | H2 | 2.016 | Diatomic |
| Helium | He | 4.003 | Noble gas |
| Methane | CH4 | 16.043 | Alkane |
| Ammonia | NH3 | 17.031 | Compound |
| Neon | Ne | 20.18 | Noble gas |
| Carbon monoxide | CO | 28.01 | Compound |
| Nitrogen | N2 | 28.014 | Diatomic |
| Dry air | mixture | 28.97 | Mixture |
| Oxygen | O2 | 31.998 | Diatomic |
| Hydrogen sulfide | H2S | 34.081 | Compound |
| Argon | Ar | 39.948 | Noble gas |
| Carbon dioxide | CO2 | 44.01 | Compound |
| Nitrous oxide | N2O | 44.013 | Compound |
| Propane | C3H8 | 44.097 | Alkane |
| Butane | C4H10 | 58.124 | Alkane |
| Chlorine | Cl2 | 70.906 | Diatomic |
| Sulfur dioxide | SO2 | 64.066 | Compound |
| Krypton | Kr | 83.798 | Noble gas |
| Xenon | Xe | 131.293 | Noble gas |
Standard molar masses for frequently encountered gases. Use these to identify an unknown gas or verify your result.
Frequently asked questions
What is the formula for the molar mass of a gas?
The formula is M = mRT / (ZPV), derived from the ideal gas law. Here m is the sample mass in grams, R is the gas constant (0.082057 L·atm/mol·K), T is absolute temperature in Kelvin, Z is the compressibility factor (1 for an ideal gas), P is pressure in atm, and V is volume in litres. The same result comes from first calculating n = PV / (ZRT) and then M = m / n.
Why do I need to convert temperature to Kelvin?
The ideal gas law requires absolute temperature. At 0 K all molecular motion stops and gas volume theoretically reaches zero, so Kelvin is the natural scale for gas calculations. If you used Celsius, a temperature of 0°C would give a zero denominator in P/T = nR/V, which is physically wrong. The conversion is T(K) = T(°C) + 273.15. This calculator does the conversion automatically when you select Celsius or Fahrenheit.
What is the compressibility factor Z, and when should I change it from 1?
Z = PV/(nRT) is a dimensionless correction that measures how much a real gas deviates from ideal behaviour. At low pressures and temperatures well above the boiling point, Z is effectively 1 for most gases, and the ideal gas law is accurate to within a fraction of a percent. Z becomes important for high-pressure gas streams (above a few atm), gases near their critical temperature, or gases with strong intermolecular forces such as ammonia or steam. Tabulated Z values are available in Perry's Chemical Engineers' Handbook, the NIST WebBook, and Nelson-Obert generalized charts.
Does this method work for mixtures of gases?
Yes, but the result is the apparent or average molar mass of the mixture, not the molar mass of any individual component. Because the ideal gas law is additive for mixtures (Dalton's law of partial pressures), the n calculated from PV = nRT is the total moles of all species, and M = m/n gives the mass-weighted mean molar mass. Dry air, for example, gives about 28.97 g/mol by this method, reflecting the weighted average of nitrogen (28.01), oxygen (32.00), and argon (39.95).
What is standard molar volume and why is it 22.414 L?
Standard molar volume is the volume one mole of an ideal gas occupies at STP (0°C, 1 atm). Substituting into V = nRT/P: V = 1 mol × 0.082057 L·atm/mol·K × 273.15 K / 1 atm = 22.414 L. At the newer IUPAC SATP (25°C, 100 kPa) the value is 24.790 L/mol. The figure is useful as a quick sanity check: if you weigh a gas sample that occupies 22.414 L at STP, dividing that mass by 1 mol gives the molar mass directly.
How accurate is the ideal gas law for finding molar mass?
At atmospheric pressure and temperatures well above the boiling point of the gas, the ideal gas law gives molar masses accurate to about 0.1-1%, which is usually sufficient for identification purposes. At 10 atm the error can reach a few percent for common gases. At pressures of 100 atm or near the critical point, errors can be 10% or more and the compressibility factor Z must be included. For precision work, gas chromatography-mass spectrometry or high-resolution mass spectrometry gives much more accurate molar masses than the PV = nRT method.