⚗️Molar Mass Calculator
Type any chemical formula and instantly get the molar mass in g/mol, a per-element breakdown, percent composition, and mass-to-moles conversion. Handles parentheses, nested groups, and hydrate notation like CuSO₄·5H₂O.
Per-element Breakdown
| Element | Symbol | Count | At. Weight (g/mol) | Contribution (g/mol) | % Composition |
|---|
Mass ↔ Moles Conversion
Enter a mass (g) to get moles, or enter moles to get mass — auto-updated when the formula changes.
Free Molar Mass Calculator Online
Need the molar mass of a compound fast? Our free Molar Mass Calculator computes it the moment you type a chemical formula. As a fast and reliable molar mass calculator, it parses any formula—from simple ones like H₂O to complex compounds with parentheses and hydrates like Ca(OH)₂ or CuSO₄·5H₂O—and returns the molar mass in g/mol instantly.
But it does more than one number. Get a per-element breakdown showing how each element contributes, see the percent composition by mass, and convert between grams and moles in a click—perfect for stoichiometry and lab prep. Whether you're a student tackling chemistry homework, a teacher building worksheets, or working in the lab, the full picture is one formula away.
Simply type your chemical formula and see the results instantly. No sign-up, no downloads, no limits—just accurate chemistry whenever you need it.
About the Molar Mass Calculator
Key features
Formula parsing with parentheses
A stack-based parser correctly expands any level of nested parentheses and subscripts — Ca(OH)₂, Al₂(SO₄)₃, and more complex coordination compounds all parse accurately.
Hydrate notation
Accepts the middle dot (·) and plain period (.) as hydrate separators, with an optional multiplier for the water of crystallisation — CuSO₄·5H₂O, MgSO₄·7H₂O, etc.
Per-element breakdown
Shows each element's name, symbol, atom count, atomic weight, and contribution to the total molar mass — so you can trace exactly where every gram comes from.
Percent composition
Displays each element's percentage by mass with a proportional bar, making it easy to compare contributions at a glance — useful for identifying the dominant element in a compound.
Mass ↔ Moles conversion
Enter a mass in grams to get moles, or enter moles to get mass in grams. Both fields update instantly and recalculate automatically when the formula changes.
IUPAC atomic weights
Uses standard IUPAC atomic weights for all 118 elements, consistent with the values in chemistry textbooks and the NIST database. Results are reported to four decimal places.
Who it's for
Students
Verify homework answers, check percent composition for empirical formula problems, or confirm stoichiometric mole ratios before a calculation.
Teachers
Build worked examples live in class — change the formula and instantly see how the breakdown and percent composition change.
Lab professionals
Quickly convert between grams and moles for solution preparation, reagent weighing, and yield calculations — especially useful for hydrated salts.
Exam candidates
Use it to check answers during practice sessions. The per-element table shows the working step by step, confirming whether your manual calculation matches.
How the calculation works
The calculator normalises your input (replacing Unicode subscripts like ₂ with digits, and Unicode dots · with periods), then splits the formula at any hydrate separator. Each segment is parsed by a stack-based recursive algorithm: opening parentheses push a new accumulator onto the stack; closing parentheses pop it, multiply each element count by the subscript after the closing bracket, and merge the results into the parent level. Element symbols are matched case-sensitively so that, for example, Co (cobalt) and CO (carbon monoxide) are treated correctly.
Once the atom counts for every element are determined, the molar mass is computed as M = Σ (count × atomic weight) over all elements present. Percent composition for element i is % i = (count_i × AW_i / M) × 100. The mass-to-moles conversion uses n = m / M and the inverse m = n × M.
If any element symbol in the formula is not recognised, or if the parentheses are unbalanced, the tool shows a specific error message rather than returning a silent wrong answer.
Frequently Asked Questions
How does the molar mass calculator work?
Type a chemical formula and the tool parses each element symbol and its subscript count, multiplies each by its standard atomic weight, and sums the results to give the total molar mass in g/mol — updating instantly as you type, no button refresh needed.
Is this molar mass calculator free to use?
Yes, it's completely free with no sign-up, downloads, or limits. Calculate as many formulas as you need, as often as you like. Everything runs in your browser and your data is never sent to a server.
What is molar mass?
Molar mass is the mass of one mole of a substance, expressed in grams per mole (g/mol). It equals the sum of the atomic weights of all atoms in the chemical formula. For water (H₂O), that is 2 × 1.008 + 15.999 = 18.015 g/mol. Molar mass lets you convert between a measurable mass in grams and the number of moles you have, which is central to all stoichiometry calculations.
Can it handle parentheses and complex formulas?
Yes. The parser uses a stack-based algorithm that handles nested parentheses and subscript multipliers correctly. For example, Ca(OH)₂ expands to Ca, 2×O, 2×H, and Al₂(SO₄)₃ expands to 2×Al, 3×S, 12×O. Any depth of nesting is supported.
Does it support hydrates like CuSO₄·5H₂O?
Yes. The calculator recognises the hydrate dot notation, accepting both the middle dot (·) and a plain period (.) as separators. The number after the dot multiplies the formula that follows, so CuSO₄·5H₂O correctly adds 5 water molecules (10×H, 5×O) to the copper sulfate, giving a molar mass of approximately 249.68 g/mol.
Does it show percent composition?
Yes. Along with the total molar mass, the per-element breakdown table shows each element's contribution in g/mol and its percentage by mass. A proportional bar in the table makes it easy to compare contributions at a glance. The percentages sum to 100%.
Can it convert between grams and moles?
Yes. The Mass ↔ Moles conversion panel lets you enter a mass in grams to get the number of moles (moles = mass ÷ molar mass), or enter a number of moles to get the mass in grams (mass = moles × molar mass). Both fields update instantly, and when you change the formula the conversion recalculates automatically.
How accurate are the atomic weights used?
The calculator uses standard IUPAC atomic weights, the same values used in chemistry textbooks and coursework. For example, H = 1.008, C = 12.011, O = 15.999, Na = 22.990, Cl = 35.453. Results are displayed to four decimal places, which is consistent with the precision of the underlying atomic weight data.
Does it work on mobile devices?
Yes, the tool is fully responsive and works on smartphones, tablets, and desktops without any installation. The formula input, results table, percent-composition bars, and mass-to-moles conversion all adapt to the screen width.
What if I enter an invalid formula?
If a formula can't be parsed — for example an unknown element symbol like Xy, a lowercase start like h2o instead of H2O, or mismatched parentheses — the tool shows a specific error message describing the problem so you can correct it. It will not return a wrong result for an invalid formula.