Molar Mass Calculator
Enter a chemical formula and instantly get its molar mass in grams per mole, plus the mass contribution of every element.
18.02
g/molO
88.8%
H
11.2%
- 1
O × 1 atom
1 × 15.999 = 15.999 - 2
H × 2 atoms
2 × 1.008 = 2.016 - 3
Molar mass (sum of contributions)
15.999 + 2.016 = 18.015
How does this calculator work?
Molar mass is the sum of each element’s atomic weight times how many of that atom appear in the formula, reported in grams per mole. Enter a formula like H2O (18.015 g/mol) or Ca(OH)2 and the tool parses subscripts and parentheses, then shows the total plus each element’s mass contribution.
Formula
How this is calculated
Type any chemical formula such as H2O, NaCl, or Ca(OH)2. The calculator parses the formula into element-and-count pairs, fully supporting subscripts and nested parentheses or brackets (the multiplier after a closing bracket is applied to every element inside the group).
Each element count is multiplied by that element’s standard atomic weight (in g/mol), taken from a built-in table of common elements based on IUPAC standard atomic weights. Summing these products gives the molar mass, also called molecular weight or formula weight, expressed in grams per mole. The donut chart and table break the total down by element so you can see which atoms dominate the mass.
Element symbols are case sensitive: the first letter is uppercase and any second letter is lowercase (Co is cobalt, while CO is carbon plus oxygen). If the formula contains an unknown element, mismatched brackets, or invalid characters, the calculator returns no result. Isotopes, charges, and hydrate dot notation are not parsed.
Frequently asked questions
They are numerically the same value for a given compound. Molecular weight (or formula weight) is a relative, unitless ratio of masses, while molar mass carries the unit grams per mole (g/mol). This tool reports the value in g/mol.
Use parentheses or brackets with a trailing subscript, like Ca(OH)2 or Fe2(SO4)3. The multiplier after the closing bracket is distributed across every element inside it.
Check that element symbols are correctly capitalized (e.g. Na, not NA), that all brackets are balanced, and that every element is in the supported list of common elements.
Also known as
TG we-Calculate Editorial Team. (2026). Molar Mass Calculator [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/molar-mass-calculator
TG we-Calculate Editorial Team. "Molar Mass Calculator." TG we-Calculate. 2026. https://we-calculate.com/calculator/molar-mass-calculator.
TG we-Calculate Editorial Team, "Molar Mass Calculator," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/molar-mass-calculator
@misc{wecalculate_molar_mass_calculator, title = {Molar Mass Calculator}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/molar-mass-calculator}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
