Calculate molar mass of chemical compounds from a chemical formula (e.g., HโO, NaCl).
Reviewed by the CalculatorKosh Editorial TeamUpdated June 2026Free ยท No sign-up
Molecular Weight Calculator
Calculate molar mass of chemical compounds from a chemical formula (e.g., HโO, NaCl).
Quick examples
Use element symbols followed by numbers (e.g. H2O, C6H12O6)
How It Works
The molecular weight (also called molar mass) of a compound is the combined mass of every atom in its chemical formula, expressed in grams per mole (g/mol). It tells you how many grams of a substance make up one mole โ that is, one Avogadro's number (6.022 ร 10ยฒยณ) of molecules or formula units. This calculator takes a chemical formula, adds up the atomic weight of each element multiplied by how many times it appears, and returns the total molar mass together with a per-element breakdown so you can see exactly where the mass comes from. Just type a formula such as H2O, NaCl, or C6H12O6, or tap one of the quick examples.
Molar mass is one of the most-used quantities in all of chemistry. It is the bridge between the mass you can weigh on a balance and the number of moles a reaction actually consumes or produces. Students need it for stoichiometry homework and lab reports; teachers use it to set and check problems; and anyone preparing a solution of a given molarity has to know the molar mass of the solute before they can weigh out the right amount. This tool is aimed at school and college chemistry students, lab technicians, and self-learners who want a fast, reliable answer with the working shown.
How molar mass is calculated
The method is a straightforward weighted sum. For each distinct element in the formula, take its standard atomic weight from the periodic table and multiply by the subscript โ the small number that says how many of that atom are present. Add those products together and the total is the molar mass in g/mol. An element written without a subscript is counted once. The atomic weights this calculator uses are the conventional periodic-table averages, for example hydrogen 1.008, carbon 12.011, nitrogen 14.007, oxygen 15.999, sodium 22.990, and chlorine 35.453 g/mol.
How to enter formulas
Write each element symbol with a capital first letter and, where it has one, a lowercase second letter โ H, O, Na, Cl, Fe โ followed immediately by its subscript number with no spaces, as in H2O or C6H12O6. Elements with no number are treated as a count of one. Please note that this calculator deliberately does not support parentheses or hydrate dots: a formula like Ca(OH)2 must be entered in its expanded form, CaO2H2, and water of crystallisation should be folded into the main formula. This is a safety choice โ rather than silently mis-parse a grouped formula and return a wrong mass, the tool asks you to expand it so the answer is always correct.
Worked example
Consider glucose, C6H12O6. There are 6 carbons, 12 hydrogens, and 6 oxygens. The carbon contribution is 6 ร 12.011 = 72.066 g/mol, the hydrogen contribution is 12 ร 1.008 = 12.096 g/mol, and the oxygen contribution is 6 ร 15.999 = 95.994 g/mol. Adding these gives a molar mass of 180.156 g/mol. A simpler case is water, H2O: 2 ร 1.008 + 1 ร 15.999 = 2.016 + 15.999 = 18.015 g/mol. For carbon dioxide, CO2, the total is 12.011 + 2 ร 15.999 = 44.009 g/mol, table salt NaCl comes to 58.443 g/mol, and ammonia NH3 works out to 17.031 g/mol. The per-element breakdown panel shows each of these subtotals so you can follow the arithmetic.
Putting molar mass to work
Once you have the molar mass, two everyday conversions follow immediately. To find the number of moles in a sample, divide its mass by the molar mass: 36 g of water รท 18.015 g/mol โ 1.998 moles. To go the other way, multiply moles by molar mass to get grams. These two relationships underpin almost every stoichiometry calculation, from balancing reaction quantities to working out the concentration of a solution you are about to make.
Common mistakes
The single most common slip is forgetting to multiply by the subscript โ adding one oxygen for CO2 instead of two, for example. Another is misreading case: "CO" is carbon monoxide (one carbon, one oxygen), whereas "Co" is the element cobalt, so capitalisation genuinely changes the molecule. Students also sometimes try to enter a bracketed formula such as Ca(OH)2 directly; because grouping is not supported here, expand it to CaO2H2 first. Finally, remember that molar mass is a sum of atomic weights โ there is no separate "bond mass" to add, since the atoms themselves account for all of a molecule's mass.
Frequently Asked Questions
Molecular weight (molar mass) is the mass of one mole (6.022 ร 10ยฒยณ molecules) of a substance, expressed in g/mol. It is used to convert between grams and moles, prepare solutions of known molarity, calculate yields in chemical reactions, and identify unknowns by mass spectrometry.
Part of Science & Engineering Calculators โ compare every related calculator in one place.