Molar mass of a gas calculator
Find the amount of gas and its molar mass from pressure, volume, temperature, and sample mass using the ideal gas law.
Gas sample inputs
Live results
Calculation breakdown
| Step | Expression | Result | Purpose |
|---|---|---|---|
| 1 | 25 °C + 273.15 | 298.15 K | Convert to absolute temperature |
| 2 | PV ÷ RT | 0.98135 mol | Find amount of gas |
| 3 | m ÷ n | 28.532 g/mol | Find molar mass |
How to use the molar mass of a gas calculator
What this calculator does. This tool estimates the number of moles in a measured gas sample and then calculates its molar mass. It applies the ideal gas law, PV = nRT, followed by M = m/n. The result can help identify an unknown gas, check a laboratory measurement, or compare an experimental value with a known molecular formula. It does not determine chemical identity by itself and it does not correct for non-ideal behavior, water vapor, leaks, buoyancy, or instrument calibration.
When to use it. Use it when you have weighed a gas in a known container, when a reaction produces a measurable gas sample, when you want to verify a gas-density experiment, or when you need to convert pressure-volume-temperature measurements into amount of substance. The underlying relationship is described in the LibreTexts explanation of gas density and molar mass.
How to calculate. The calculator opens with a complete demonstration: 1 atm, 24 L, 25 °C, and 28 g. Its workbook is ready immediately.
- Replace each demonstration value with your measured pressure, volume, temperature, and gas mass.
- Select the unit beside each value. A unit change converts the current value so the physical quantity stays the same.
- Read the live molar mass, moles, density, molar volume, and calculation breakdown.
- Select Download Excel to create a current-state workbook with inputs, results, formulas, and checks.
- Select Reset to clear the demonstration and all results. Download Excel is then disabled until all four required values are valid again.
Input guide. Pressure is required, must be a finite positive absolute pressure, and accepts atm, kPa, bar, or mmHg; 1 atm is a realistic example. Do not enter gauge pressure without converting it to absolute pressure. Higher pressure, with the other measurements fixed, lowers the calculated molar mass because the inferred mole count rises. Volume is required and accepts L, mL, or m³; 24 L is the demonstration value. It must be greater than zero, and container volume should match the gas volume under the stated conditions. Increasing volume raises the inferred mole count and therefore lowers molar mass when mass is unchanged. Temperature is required and accepts °C, K, or °F; 25 °C is the example. The converted temperature must remain above absolute zero. Using Celsius directly in the gas-law equation is a common mistake, so the calculator converts it to kelvins. Higher absolute temperature raises the calculated molar mass for fixed pressure, volume, and mass. Gas sample mass is required and accepts g, kg, or mg; 28 g is the example. Use the net mass of gas only. A container, stopper, or moisture contribution will bias the result upward. Molar mass changes directly with sample mass.
Output guide. Molar mass is the primary estimate in g/mol. A low or high value is meaningful only relative to candidate gases and measurement uncertainty. Amount of gas is the ideal-law mole count in mol, driven by pressure, volume, and absolute temperature. Gas density is mass divided by volume in g/L and is an exact identity for the entered sample. Molar volume is volume per mole in L/mol and depends mainly on pressure and temperature under the ideal assumption. Gas constant used shows the numerical constant paired with L, atm, mol, and K. The four summary pills repeat the normalized physical inputs, while the calculation breakdown shows the Kelvin conversion, mole calculation, and molar-mass division.
Worked example. For the startup sample, temperature becomes 298.15 K. Using the NIST molar gas constant in compatible units, the amount is n = (1.000 × 24.000) ÷ (0.0820574 × 298.15) = 0.98135 mol. Dividing 28.000 g by 0.98135 mol gives 28.532 g/mol. The same values appear in the first-open results and workbook.
Formula, assumptions, and interpretation
The ideal gas law gives n = PV/(RT). Substituting that expression into M = m/n produces M = mRT/(PV). An equivalent density form is M = ρRT/P, because density is mass divided by volume. NASA's ideal-gas equation of state explains how pressure, temperature, and density describe a gas state.
The calculation is most reliable at modest pressures and temperatures well above the gas's condensation region. At high pressure, intermolecular forces and molecular volume can make the ideal model inaccurate. Wet gas samples also need a dry-gas pressure correction: subtract water-vapor partial pressure before entering pressure. For careful work, record instrument uncertainty and report a sensible number of significant figures rather than treating every displayed digit as experimentally certain.
Common mistakes include entering gauge instead of absolute pressure, mixing milliliters with a gas constant expressed in liters, using Celsius rather than kelvins in the equation, and weighing the container along with the gas. The LibreTexts ideal gas law derivation provides additional background on these relationships.