Molar Mass Calculator
Type a chemical formula and get its molar mass in grams per mole instantly. The calculator sums standard IUPAC atomic weights, shows a full per-element breakdown, converts between grams and moles in either direction, counts molecules using Avogadro's number, and optionally derives molar mass from ideal-gas P, V, T, m data.
Formula
Worked example
Glucose (C6H12O6): M = 6 x 12.011 + 12 x 1.008 + 6 x 15.999 = 72.066 + 12.096 + 95.994 = 180.156 g/mol. For 36 g of glucose: n = 36 / 180.156 = 0.1998 mol, N = 0.1998 x 6.022 x 10^23 = 1.203 x 10^23 molecules. Ideal gas example: 2 g of unknown gas at 1 atm, 273.15 K, 1 L gives n = (1 x 1)/(0.08206 x 273.15) = 0.04462 mol, M = 2 / 0.04462 = 44.8 g/mol (close to CO2 at 44.01 g/mol).
How molar mass is computed from a formula
Molar mass (M) is the mass of one mole of a substance in grams per mole (g/mol). For any compound it is the sum, over every atom in the chemical formula, of that element's standard atomic weight multiplied by how many times it appears: M = sum of a_i times A_i, where a_i is the atom count and A_i is the IUPAC atomic weight. This calculator parses the formula you type, expands any parentheses, brackets, and hydrate dot notation into element counts, then adds up each contribution. The output is also available in kg/mol, Daltons (Da), or atomic mass units (u), all numerically consistent with the g/mol value. Because the atomic weights used are the 2021 IUPAC conventional values, results match a careful hand calculation from a standard periodic table.
Grams-to-moles, moles-to-grams, and molecule counting
Switch the conversion mode selector to go beyond molar mass. Grams to moles (n = m / M) is the most common lab conversion: enter a sample mass and read off the amount of substance. Moles to grams (m = n x M) is the reverse, useful for weighing out a specific amount. Both moles to molecules and grams to molecules apply Avogadro's number (NA = 6.02214076 x 10^23 mol^-1), the exact value fixed by the 2019 SI redefinition, to count individual molecules or formula units in a sample. All four conversions are live, meaning the result updates as you change the formula or the quantity.
Ideal-gas molar mass from P, V, T, and m
Enable the ideal-gas panel to identify an unknown gas from experimental data. The ideal gas law PV = nRT can be rearranged to M = mRT / PV, where m is the mass of gas in grams, R is the gas constant (0.082057 L·atm/(mol·K)), T is temperature in Kelvin, P is pressure in atm, and V is volume in litres. Enter values in any of the supported units (atm, kPa, bar, or mmHg for pressure; L, mL, or m3 for volume; K, Celsius, or Fahrenheit for temperature) and the calculator converts internally before applying the formula. This method is accurate for light gases at low pressure and temperature near ambient; real gases deviate from ideal behaviour at high pressures.
Reading the per-element breakdown
Below the result you get a composition table listing each element, its IUPAC atomic weight, the number of atoms per formula unit, the subtotal it contributes in g/mol, and its percent by mass. Percent by mass is the element subtotal divided by the total molar mass times 100, and the percentages always add to 100. This breakdown is what you need for empirical-formula problems, fertiliser nutrient ratios, and purity checks. The table is sorted by the largest contributor first so the dominant elements are easy to spot.
Formula syntax the parser accepts
Start every element with a capital letter and add a lower-case second letter where it has one, so sodium is Na and chlorine is Cl. Put the count as a subscript directly after the symbol, for example O2 or C6. Group repeated units in parentheses or square brackets with a multiplier outside, such as Ca(OH)2 or Al2(SO4)3. For hydrates, separate the water of crystallisation with an asterisk or a period and a leading coefficient, for example CuSO4*5H2O or Na2CO3.10H2O. Spaces are ignored. If a symbol is unrecognised or the brackets do not balance, the calculator returns a clear message rather than a wrong number.
Molar masses of common substances
| Substance | Formula | Molar mass (g/mol) |
|---|---|---|
| Water | H2O | 18.015 |
| Hydrogen | H2 | 2.016 |
| Oxygen | O2 | 31.998 |
| Nitrogen | N2 | 28.014 |
| Carbon dioxide | CO2 | 44.009 |
| Ammonia | NH3 | 17.031 |
| Methane | CH4 | 16.043 |
| Ethanol | C2H5OH | 46.068 |
| Sodium chloride | NaCl | 58.44 |
| Hydrochloric acid | HCl | 36.458 |
| Sulfuric acid | H2SO4 | 98.079 |
| Sodium hydroxide | NaOH | 39.997 |
| Calcium carbonate | CaCO3 | 100.087 |
| Glucose | C6H12O6 | 180.156 |
| Sucrose | C12H22O11 | 342.297 |
| Aspirin | C9H8O4 | 180.159 |
| Sodium bicarbonate | NaHCO3 | 84.007 |
| Copper(II) sulfate pentahydrate | CuSO4*5H2O | 249.685 |
| Aluminum sulfate | Al2(SO4)3 | 342.154 |
| Iron(III) oxide | Fe2O3 | 159.688 |
Computed from standard IUPAC 2021 atomic weights. Type any formula in the box to see the full breakdown.
Frequently asked questions
What formula formats can I enter?
Type element symbols with subscripts, like H2O or C6H12O6. You can group units with parentheses or square brackets and a multiplier, such as Ca(OH)2 or Al2(SO4)3, and you can write hydrates with an asterisk or a period plus a coefficient, such as CuSO4*5H2O or Na2CO3.10H2O. Symbols must use a capital first letter and an optional lower-case second letter, so sodium is Na rather than NA. Spaces are ignored, and an unknown element or unbalanced bracket returns a clear message instead of a wrong answer.
How do I convert grams to moles or moles to grams?
Set the conversion mode to "Grams to moles" and enter your sample mass in grams; the calculator applies n = m / M. To go the other way, choose "Moles to grams" and enter a mole count; the calculator returns m = n times M. Both conversions update live as you change the formula or the quantity, so you can explore different compounds without re-entering data.
How do I count molecules or formula units?
Choose "Moles to molecules" or "Grams to molecules" from the conversion mode. The calculator multiplies moles by Avogadro's number, NA = 6.02214076 times 10^23 mol^-1, which is the exact value fixed by the 2019 redefinition of the SI mole. The result is the number of individual molecules (or formula units, for ionic compounds) in your sample.
What is the ideal-gas molar mass panel for?
It lets you identify an unknown gas from a simple experiment: seal the gas in a container, record pressure P, volume V, temperature T, and weigh the gas to get mass m. The rearranged ideal gas law M = mRT / PV gives the molar mass. This is useful in lab settings when the compound is a gas and its formula is unknown. The result is only accurate for ideal-gas conditions; light gases at low pressure and near room temperature behave most ideally.
What is the difference between molar mass and molecular weight?
They are numerically equal but conceptually different. Molecular weight, or relative molecular mass, is a dimensionless ratio comparing a molecule's mass to one twelfth of a carbon-12 atom. Molar mass is the mass of one mole of that substance and carries the unit grams per mole. Because the numbers match, the g/mol value this calculator reports is also the molecular weight, which is why the two terms are often used interchangeably.
Why might my value differ slightly from another source?
Small differences come from which atomic weights are used. This tool uses the conventional IUPAC 2021 standard atomic weights, the single representative value for each element. Some references quote more decimal places, slightly older values, or interval-based ranges for elements like chlorine and sulfur, so the last decimal can vary. For most coursework and lab work the difference is negligible. If you need exact isotopic masses, use a source that lets you specify the isotope.
Can I report molar mass in units other than g/mol?
Yes. Use the output unit selector to display the result in kg/mol (divide g/mol by 1000, common for polymer science), Daltons (Da), or atomic mass units (u). Daltons and atomic mass units are numerically the same as g/mol when using conventional atomic weights, so 18.015 g/mol for water equals 18.015 Da. The kg/mol value for water is 0.018015 kg/mol.