A gas you cannot see can still be weighed, and once you know its mass, its volume, its pressure and its temperature, you can work out its molar mass. Run 4.00 g of gas filling 22.4 L at 1.00 atm and 273.15 K through this free molar mass of gas calculator and the answer is 4.00 g/mol, with 1.00 mol of gas present and a density of 0.179 g/L. The closest known gas is helium, at 4.003 g/mol, which is how a nineteenth century chemist would have started identifying an unknown gas, and how a student still does it today. The calculator uses the ideal gas law, rearranged so that the molar mass comes straight out of four measurements. You weigh the gas, you measure the volume it fills, you read the pressure and the temperature, and the formula does the rest. No formula for the gas itself is needed, which is the whole point: the method identifies a gas from its behaviour, not from a label on a bottle.
Enter the mass in grams, the volume in litres, the pressure in atmospheres and the temperature in kelvin. Temperature must be in kelvin: 0 degrees C is 273.15 K. The calculator updates as you type, and the Calculate button runs it again at any time.
Enter a mass, volume, pressure and temperature above zero. Temperature must be in kelvin.
| Gas | Formula | Molar Mass (g/mol) | Density at STP (g/L) |
|---|---|---|---|
| Hydrogen | H2 | 2.016 | 0.090 |
| Helium | He | 4.003 | 0.179 |
| Methane | CH4 | 16.043 | 0.716 |
| Ammonia | NH3 | 17.031 | 0.760 |
| Nitrogen | N2 | 28.014 | 1.250 |
| Oxygen | O2 | 31.999 | 1.428 |
| Carbon dioxide | CO2 | 44.009 | 1.963 |
| Argon | Ar | 39.948 | 1.782 |
Eight common gases with molar mass and density at STP (0 degrees C, 1 atm). Density is molar mass divided by 22.414 L/mol, the molar volume at that STP. The row whose molar mass is within 0.5 g/mol of your result is highlighted. At the defaults, 4.00 g/mol, the helium row is highlighted: 4.003 g/mol and 0.179 g/L.
Founder & CEO, Techraxy
Faiq Ur Rahman is a web designer, digital product developer, and Founder of Techraxy, a growing platform of online calculators and utility tools. He specializes in building structured, user-friendly tools focused on finance, health, conversions, productivity, and everyday problem-solving. He is passionate about developing practical digital solutions that make complex tasks simpler for users worldwide.
User Ratings:
ADVERTISEMENT
ADVERTISEMENT
A molar mass of gas calculator is a tool that finds the molar mass of a gas sample, in grams per mole, from its mass, volume, pressure and temperature, using the ideal gas law. Molar mass is the mass of one mole of a substance, so it is the bridge between the grams you can weigh on a balance and the moles a chemical equation counts in. If you know a formula instead of a gas sample, the Molar Mass Calculator works it out from the formula. The method rests on two definitions. First, the ideal gas law, PV equals nRT, links pressure, volume, amount in moles and temperature through the gas constant R. Second, the amount in moles is the mass divided by the molar mass, n equals m divided by M. Put the second into the first and solve for M, and you get M equals mRT divided by PV. The calculator also reports the amount itself, n equals PV divided by RT, and the density, mass divided by volume, because both fall out of the same four measurements. The result is an ideal-gas result, and the article says so plainly because the distinction matters. The ideal gas law treats gas particles as points with no volume and no attractions, which is a good approximation at ordinary pressures and temperatures, but real gases deviate, especially at high pressure or low temperature near condensation. The closest-gas match is a hint, not an identification: a mixture can have the same average molar mass as a pure gas, and different gases can share a molar mass.
Enter the mass of the gas in grams, the volume it fills in litres, the pressure in atmospheres and the temperature in kelvin. The defaults are 4.00 g, 22.4 L, 1.00 atm and 273.15 K, which is 0 degrees C, and they give a molar mass of 4.00 g/mol. The calculator updates as soon as you change a value, and the Calculate button runs it again at any time. Temperature must be in kelvin, and this is the most common mistake with this calculation. The ideal gas law needs absolute temperature, so convert first: kelvin equals degrees C plus 273.15. Entering 0 for 0 degrees C would give a division by zero, so the calculator rejects zero and negative temperatures, and any zero, negative or empty input, with a message asking for values above zero. Read the results in order. Molar mass is the headline number, in grams per mole. The amount of gas is next, in moles, then the density in grams per litre, then the closest known gas from the compare table. The substitution row shows your numbers in the formula, so you can check the arithmetic. The diagram shows the gas as a balloon full of particles: the balloon grows and shrinks with volume, the number of particles follows the amount of gas, and the particles spread and turn with amount and temperature, so every input change moves the picture. The Compare Gases tab puts eight common gases side by side, with molar mass and density at STP, 0 degrees C and 1 atm. The row whose molar mass is within 0.5 g/mol of your result is highlighted, so you can see at a glance which known gas your sample resembles.
The formula is M equals mRT divided by PV, where m is the mass in grams, R is the gas constant, 0.082057 L atm per mol K, T is the temperature in kelvin, P is the pressure in atmospheres and V is the volume in litres. The amount of gas is n equals PV divided by RT, and the density is mass divided by volume. Written out for the defaults, 4.00 g, 22.4 L, 1.00 atm and 273.15 K: R times T is 0.082057 times 273.15, which is 22.4139. The mass times that is 4.00 times 22.4139, which is 89.6556. The pressure times the volume is 1.00 times 22.4, which is 22.4. Dividing 89.6556 by 22.4 gives 4.00 g/mol, to two decimal places. The amount is 1.00 times 22.4 divided by 22.4139, which is 1.00 mol, and the density is 4.00 divided by 22.4, which is 0.179 g/L. The same numbers give a second form of the formula that is worth knowing. Since density is mass divided by volume, M equals mRT divided by PV can be rewritten as M equals density times RT divided by P. If you know a gas density at a known pressure and temperature, you can get its molar mass without weighing a sample of known volume. STP needs a word of its own, because two definitions are in use. This calculator uses the older textbook STP, 0 degrees C and 1 atm, at which one mole of an ideal gas occupies 22.414 L, so the compare densities are molar mass divided by 22.414. IUPAC’s current STP is 0 degrees C and 100 kPa, one bar, where the molar volume is 22.711 L/mol. The two differ by about 1.3 percent, entirely because 100 kPa is slightly less than 1 atm, 101.325 kPa, and the calculator states which one it uses so the numbers can be checked.
Take 32.0 g of gas occupying 22.4 L at 1.00 atm and 273.15 K. Start with R times T: 0.082057 times 273.15 is 22.4139. Multiply by the mass: 32.0 times 22.4139 is 717.24. Divide by pressure times volume: 1.00 times 22.4 is 22.4, and 717.24 divided by 22.4 is 32.02 g/mol. The amount is 1.00 times 22.4 divided by 22.4139, which is 1.00 mol, and the density is 32.0 divided by 22.4, which is 1.429 g/L. The closest known gas is oxygen, at 31.999 g/mol, only 0.02 g/mol away, so the sample behaves like oxygen. The same steps check the other gases in the table. For 44.0 g of gas in 22.4 L at 1.00 atm and 273.15 K, the numerator is 44.0 times 22.4139, which is 986.21, divided by 22.4 gives 44.03 g/mol, closest to carbon dioxide at 44.009 g/mol, with a density of 1.964 g/L. For 2.00 g in the same volume at the same pressure and temperature, the molar mass is 2.00 g/mol, closest to hydrogen at 2.016 g/mol, with a density of 0.089 g/L. For 16.04 g in 24.5 L at 1.00 atm and 298 K, the molar mass is 16.01 g/mol, closest to methane at 16.043 g/mol.
The first benefit is identifying an unknown gas from four ordinary measurements. A balance, a flask of known volume, a pressure gauge and a thermometer are enough: weigh the gas, fill the flask, read the pressure and temperature, and the molar mass points at a short list of candidates. That is how the Dumas method has identified volatile liquids since the nineteenth century, and it is still a standard school and university laboratory exercise. The second benefit is checking a density against a molar mass without a second experiment. The calculator reports both, so a gas density measured at one pressure and temperature can be turned into a molar mass, or a known molar mass can be turned into the density to expect. At STP the link is especially simple: density is molar mass divided by 22.414, so helium at 4.003 g/mol is 0.179 g/L while carbon dioxide at 44.009 g/mol is 1.963 g/L, which is why one floats a balloon and the other sinks in air. The third benefit is seeing the amount of gas alongside the molar mass. Knowing that 4.00 g of gas is 1.00 mol matters for stoichiometry: a reaction equation counts in moles, not grams, so the amount is the number that goes into the next calculation. The calculator gives it from the same inputs, with no extra step. The fourth benefit is learning which definition of STP a number belongs to. Textbooks quote 22.4 L/mol and 22.7 L/mol for the same mole of gas, and students often treat one of them as wrong. The calculator states its definition, 0 degrees C and 1 atm, and names the IUPAC alternative, 0 degrees C and 100 kPa, so the two numbers stop looking like a contradiction and start looking like what they are: the same gas at two slightly different reference pressures.
Measure the mass in grams, the volume in litres, the pressure in atmospheres and the temperature in kelvin, then use M equals mRT divided by PV, with R equal to 0.082057 L atm per mol K. For 32.0 g in 22.4 L at 1.00 atm and 273.15 K, the calculation is 32.0 times 0.082057 times 273.15, divided by 1.00 times 22.4, which is 32.02 g/mol. The amount of gas is n equals PV divided by RT, which is 1.00 mol here, and the density is mass divided by volume, 1.429 g/L.
Because the ideal gas law uses absolute temperature, measured from absolute zero, where gas volume and pressure extrapolate to zero. A Celsius temperature is an offset scale: 0 degrees C is 273.15 K, and doubling a Celsius temperature does not double the absolute temperature, so the law breaks if you use it. Convert first with kelvin equals degrees C plus 273.15, and never enter 0 K or a negative kelvin temperature, which are physically impossible for a gas sample. The calculator rejects zero and negative temperatures for this reason.
STP is standard temperature and pressure, a fixed reference condition for comparing gas measurements. The older textbook definition is 0 degrees C and 1 atm, where one mole of an ideal gas occupies 22.414 L, usually rounded to 22.4 L/mol. IUPAC changed the standard pressure in 1982 to 100 kPa, one bar, keeping 0 degrees C, and at that pressure one mole occupies 22.711 L/mol, usually rounded to 22.7 L/mol. Both are correct under their own definition: 100 kPa is slightly less than 1 atm, 101.325 kPa, so the same mole takes up slightly more room. This calculator uses the 0 degrees C and 1 atm definition, and its compare densities are molar mass divided by 22.414.
Because molar mass is a single number, and different gases and mixtures can share it. Carbon monoxide and nitrogen both sit near 28.0 g/mol, and ethene sits near 28.05 g/mol, so a result of 28.0 g/mol cannot pick between them. A mixture can also average out to any value at all: a mix of hydrogen and carbon dioxide can be tuned to average 16.0 g/mol and look like methane. The closest match narrows the candidates, but confirming an identity needs another test, such as a spectrum, a chemical test or a density at a second temperature.
When the gas stops behaving like widely spaced, non attracting particles: at high pressure, where the particles own volume matters, and at low temperature, where attractions pull them together and the gas nears condensation. Carbon dioxide at 1 atm and room temperature follows the law to well within a percent, but near its condensation point, or at tens of atmospheres, the error grows and a real-gas equation such as van der Waals is needed. As a rule of thumb, the law is reliable for ordinary laboratory gases near room temperature and pressure, and least reliable for easily liquefied gases, such as ammonia and carbon dioxide, when they are cold or compressed.
Wikipedia — Ideal gas law, with PV equals nRT, the gas constant in litre atmosphere units, and the ideal gas as a model of point particles with no attractions.
Wikipedia — Molar mass, with molar mass as mass per mole and the link between grams weighed and moles counted.
Wikipedia — Standard temperature and pressure, with the older 0 degrees C and 1 atm definition at 22.414 L/mol and the current IUPAC 0 degrees C and 100 kPa definition at 22.711 L/mol.
LibreTexts — Further Applications of the Ideal-Gas Equation, deriving gas density as PM divided by RT and molar mass as mRT divided by PV, with worked examples.
NIST — Molar gas constant, the CODATA value of R, 8.314462618 J per mol K, which converts to 0.082057 L atm per mol K in litre atmosphere units.
This calculator finds the molar mass of a gas from the ideal gas law, and it is for study, homework and general reference only. The ideal gas law is an approximation: real gases deviate, especially at high pressure or low temperature near condensation, so the molar mass it returns is an ideal-gas estimate, not a measured molecular weight. The closest-gas match is a hint, not an identification, because mixtures and different gases can share a molar mass. STP has two definitions in use, 0 degrees C and 1 atm with a molar volume of 22.414 L/mol, and 0 degrees C and 100 kPa with 22.711 L/mol, and this calculator uses the first; check which definition your course uses before quoting a density or a molar volume. Do not use the result to identify a gas for safety purposes: an unknown gas must be identified by proper laboratory tests, not by a single number.
Last updated: 30 November 2026
ADVERTISEMENT
ADVERTISEMENT