Molar Mass of Gas Calculator
Calculate the molar mass of a gas using the ideal gas law.
Supports 10 pressure units, 4 temperature scales, 10 volume units, 7 mass units, and 5 mole units.
Updated August 30, 2026
Introduction
The molar mass of a gas is the mass of one mole of that gas, expressed in grams per mole (g/mol). It connects the microscopic world of molecules to the macroscopic quantities you can measure in a lab — pressure, volume, temperature, and mass.
This calculator combines two fundamental equations — the ideal gas law and the molar mass definition — into a single bidirectional tool. Enter any combination of pressure, volume, temperature, and mass, and it automatically solves for the unknowns. You can also work backwards: given a gas's molar mass and its PVT conditions, find how many moles you have.
Who is this for? Chemistry students working on gas law problems, lab technicians identifying unknown gases from experimental measurements, and engineers performing process calculations involving gas volumes and pressures.
How to use
Enter the values you know. For example, if you measured a gas sample's pressure, volume, and temperature, fill in those three fields with your measurements and units.
Enter the mass of the gas sample if you have it. With pressure, volume, temperature, and mass all provided, the calculator can determine both the number of moles and the molar mass.
The calculator automatically solves for any missing field. Results appear instantly — the molar mass tells you what gas you might be dealing with, and the moles tells you how much of it you have.
You can also fill in any other combination of knowns. For instance, if you know the molar mass and want to find the volume at given P and T conditions, just enter those three and leave volume blank.
Worked example — identifying an unknown gas
A chemist collects a gas at 100 kPa, 27 °C, in a 1.00 L flask and finds the sample weighs 1.28 g. What is the gas?
- Enter Pressure = 100 kPa
- Enter Temperature = 27 °C (the calculator converts to Kelvin internally)
- Enter Volume = 1 L
- Enter Mass = 1.28 g
The calculator first uses the ideal gas law to find moles, then divides mass by moles:
A molar mass near 32 g/mol strongly suggests oxygen gas (O₂).
Calculation method
This calculator uses two linked equations. The ideal gas law connects pressure, volume, temperature, and moles. The molar mass definitionconnects mass, moles, and molar mass. Both equations are solved bidirectionally — you can rearrange either one to solve for any unknown, as long as enough inputs are provided.
Ideal Gas Law
Where:
- — pressure (any unit; base unit is Pascal)
- — volume (any unit; base unit is m³)
- — amount of substance in moles
- = 8.31446261815324 J/(K·mol) — universal gas constant
- — absolute temperature in Kelvin (K)
From this single equation, the calculator can solve for any one of the four variables when the other three are known:
Molar Mass Definition
Where:
- — molar mass (g/mol)
- — mass of the gas sample (base unit is grams)
- — number of moles (from the ideal gas law)
This equation also works in three directions:
Unit conversion is automatic
You can mix units freely — for example, enter pressure in atm, temperature in °F, and volume in liters. The calculator internally converts everything to base SI units (Pascal, Kelvin, m³, grams) before solving, then converts results back to your selected display units.
Temperature must be positive. The calculator requires temperature greater than 0 K (absolute zero). This is a physical constraint — at 0 K, the ideal gas law produces undefined results. In Celsius, this means any temperature above −273.15 °C is valid.
Real-world examples
Identifying an unknown gas in the lab
You collect an unknown gas by water displacement at 98.5 kPa and 22 °C. The gas volume is 250 mL and the dry gas sample weighs 0.33 g. What is it?
A molar mass near 33 g/mol is consistent with hydrogen sulfide (H₂S, 34.08 g/mol)— a common laboratory gas with a distinctive rotten-egg smell.
Industrial gas storage calculation
An engineer needs to store 2.00 kg of nitrogen gas (M = 28.014 g/mol) in a cylinder at 200 bar and 25 °C. What volume is required?
This tells the engineer the minimum internal volume needed for the cylinder.
Breathalyzer calibration
A calibration standard uses ethanol vapor at 101.325 kPa (1 atm), 37 °C, with a known concentration of 0.25 mg/L. How many moles of ethanol are in a 500 mL sample?
Rather than using the ideal gas law directly (ethanol is not an ideal gas at these conditions), this example shows how the calculator handles the mass-to-moles path. Enter mass = 0.125 mg and molar mass = 46.07 g/mol:
Tips & best practices
Double-check temperature units
The most common error is entering temperature in Celsius or Fahrenheit without selecting the correct unit. The ideal gas law requires absolute temperature — if you enter 25 and the unit is set to Kelvin, you're computing for −248 °C, not room temperature.
Use consistent pressure & volume pairs
While the calculator handles unit conversions, it helps to think in familiar pairs. For lab work, kPa with liters is natural. For industrial contexts, bar with m³ is common. For US textbooks, atm with liters or psi with cubic feet may appear.
Remember the ideal gas assumption
This calculator assumes ideal gas behavior. Real gases deviate from the ideal law at high pressures (typically above ~10 bar) and low temperatures (near their condensation point). For precise work with real gases, apply a compressibility factor correction.
Use molar mass to identify unknown gases
If you measure P, V, T, and mass of an unknown gas, the computed molar mass narrows down the possibilities. Compare your result with known values: He ≈ 4.0, H₂ ≈ 2.0, N₂ ≈ 28.0, O₂ ≈ 32.0, CO₂ ≈ 44.0 g/mol.
Frequently asked questions
Why do I need at least four fields filled in?
The calculator has two equations and up to six unknowns. The ideal gas law has four variables () with fixed, so you need any three to solve for the fourth. The molar mass equation adds mass and molar mass, linked through moles. In practice, you need at least four independent inputs (or three plus the molar mass) for the system to be fully determined.
What is the universal gas constant R?
The universal gas constant relates the energy scale to the temperature scale for one mole of gas. Its valueis exact by definition in SI units. Different values appear in older textbooks using non-SI units (e.g., 0.08206 L·atm/(K·mol)), but this calculator uses the SI value internally and handles unit conversions automatically.
Can I use this for real gases like CO₂ or ammonia?
Yes, with a caveat. At moderate pressures (up to ~5–10 bar) and temperatures well above the gas's boiling point, real gases behave closely enough to ideal that the results are accurate to within 1–2%. For example, nitrogen at room temperature and 1 atm deviates by only about 0.1%. However, at very high pressures or near the condensation point, you should use more accurate equations of state (such as van der Waals or Redlich-Kwong).
Limitations
Ideal gas assumption: The calculator treats all gases as ideal (no intermolecular forces, no molecular volume). This is accurate to within ~1% for most gases at standard temperature and pressure, but becomes less accurate at high pressures (above ~10 bar) or low temperatures near the gas's boiling point.
Temperature must be above 0 K: All temperature inputs must represent a value greater than absolute zero. In Celsius, this means any temperature above −273.15 °C.
All fields must be positive: Pressure, volume, temperature, mass, moles, and molar mass all must be greater than zero. The calculator does not handle negative values or zero for these quantities.
Mixing gas compatibility: This calculator works with a single pure gas. For gas mixtures (like air), you would need to use the effective molar mass of the mixture, calculated as a mole-fraction-weighted average.
Related Calculators
Scale Calculator
Calculate scale factors and convert scaled or real dimensions for length, area, and volume.
Annealing Temperature Calculator
Estimate PCR primer annealing temperature (Ta) from primer and target melting temperatures (Tm). Supports °C / °F / K.
Crickets Chirping Thermometer
Estimate the temperature outside by counting cricket chirps with this crickets chirping thermometer calculator based on Dolbear's law.
Potting Soil Calculator
Calculate the amount of potting soil needed for your rectangular, round, or flower pot containers. Supports multiple measurement units, container quantity, and bidirectional solving.
Atom Calculator
Calculate atomic properties including protons, neutrons, electrons, atomic number and mass number
Electron Configuration Calculator
Get the electron configuration for any element from the periodic table. View atomic number, atomic mass, and valence electrons.