Molecular Weight Calculator
Type a chemical formula to get its molar mass in g/mol with a per-element breakdown and mass percent. Handles brackets, hydrates like CuSO4·5H2O and ion charges.
The interactive tool loads here when JavaScript runs.
About this toolWhat is the Molecular Weight Calculator?
Type a chemical formula and this molecular weight calculator returns the molar mass in grams per mole, the number of atoms, and a table showing each element's count, atomic weight, mass contribution and percentage of the total. A coloured bar shows the composition by mass at a glance.
The formula parser handles the notations you meet in textbooks and on reagent labels: parentheses, square and curly brackets nested to any depth, hydrates written with a middle dot, full stop or asterisk (CuSO4·5H2O, CuSO4.5H2O), Unicode subscripts copied from documents, and ionic charges such as SO4^2- or NH4+, which are ignored because electrons add almost no mass.
Atomic weights are the IUPAC/CIAAW abridged standard atomic weights. A grams-to-moles box converts a mass of the compound into moles and formula units.
- Nested brackets, hydrates, charges and Unicode subscripts
- Per-element counts, mass contribution and mass percent
- IUPAC/CIAAW abridged standard atomic weights for all 103 elements up to lawrencium
- Grams to moles and formula units
- Clear error messages for unknown symbols and unmatched brackets
How to use the Molecular Weight Calculator
- Type the formula with correct capitalisation: each element starts with a capital letter, so Co is cobalt and CO is carbon monoxide.
- Use ( ), [ ] or { } for groups with a count after the closing bracket, for example Ca(OH)2 or K4[Fe(CN)6].
- For hydrates, separate the parts with ·, . or * and put the water count first: CuSO4·5H2O.
- Read the molar mass and the element table with counts, atomic weights, mass contributions and mass percent.
- Enter a mass in grams to convert it to moles and number of formula units, then copy or share the result.
Worked examples
Glucose
Input
C6H12O6
Output
180.156 g/mol; C 40.00%, H 6.71%, O 53.28%
6 × 12.011 + 12 × 1.008 + 6 × 15.999. 10 g of glucose is 0.055507 mol.
Copper(II) sulfate pentahydrate
Input
CuSO4·5H2O
Output
249.677 g/mol
The five waters add 90.08 g/mol to the anhydrous 159.60 g/mol. Using the wrong one gives a solution 36% off.
Caffeine
Input
C8H10N4O2
Output
194.194 g/mol; C 49.48%, H 5.19%, N 28.85%, O 16.48%
Nitrogen makes up almost 29% of caffeine by mass, which is what a nitrogen analyser would measure.
Potassium ferrocyanide
Input
K4[Fe(CN)6]
Output
368.345 g/mol
The inner (CN)6 is multiplied first, then added to four potassium atoms and one iron. Brackets can nest to any depth.
Background and insight
Molar mass is the sum of the atomic weights of every atom in the formula. For water, H2O, that is 2 × 1.008 + 15.999 = 18.015 g/mol. Numerically the molar mass in g/mol equals the average molecular mass in daltons (u), which is why "molecular weight" and "molar mass" are used interchangeably in practice, although strictly the molecular weight is a dimensionless ratio.
The atomic weights come from the Commission on Isotopic Abundances and Atomic Weights (CIAAW) of IUPAC. Because isotope ratios vary in nature, the commission publishes intervals for some elements (hydrogen, carbon, oxygen, chlorine and others) and an abridged table of single values to five significant figures for everyday use, such as H 1.008, C 12.011, O 15.999 and Cl 35.45. Recent revisions changed a few values; for example zirconium was revised to 91.222 in 2021. Elements with no stable isotopes, such as technetium and plutonium, have no standard atomic weight, so the calculator uses the mass number of the longest-lived isotope and shows it in brackets.
Mass percent composition is each element's mass divided by the molar mass. It is the bridge to empirical formulas from combustion analysis, to fertiliser labels (nitrogen content of urea or ammonium nitrate) and to checking which of two salts delivers more of an ion per gram.
Common use cases
Preparing solutions
Get the molar mass to plug into a molarity or dilution calculation.
Stoichiometry homework
Convert grams to moles and check percent composition for reaction problems.
Comparing reagents
See how much of an element each salt or hydrate delivers per gram.
Checking a label
Verify the formula weight printed on a reagent bottle or safety data sheet.
Tips and limitations
- Capitalisation matters: CO (28.01) and Co (58.933) differ by a factor of two.
- Write charges with a caret (SO4^2-) or a trailing sign (NH4+). Writing SO42- without a separator reads as 42 oxygen atoms.
- Use the formula of what is in the bottle, including water of crystallisation, when weighing out a solid.
- Abridged weights carry five significant figures, so quote molar masses to about four or five significant figures.
- Isotope-labelled compounds (deuterated solvents, 13C labels) need isotope masses rather than standard atomic weights.
Frequently asked questions
How do you calculate molar mass from a chemical formula?
Multiply each element's atomic weight by the number of atoms of that element, then add them up. For CO2: 12.011 + 2 × 15.999 = 44.009 g/mol.
Is molecular weight the same as molar mass?
They have the same number. Molar mass is in grams per mole; molecular weight (relative molecular mass) is the same value without units, or in daltons for one molecule.
What is the molar mass of water?
H2O is 2 × 1.008 + 15.999 = 18.015 g/mol using IUPAC abridged atomic weights. Older tables give 18.02 or 18.016 depending on rounding.
How do I enter a hydrate like CuSO4·5H2O?
Type the anhydrous part, a separator (·, a full stop or *), then the number of waters and H2O. CuSO4.5H2O and CuSO4*5H2O both work and give 249.677 g/mol.
Which atomic weights does this calculator use?
The IUPAC/CIAAW abridged standard atomic weights, given to five significant figures. Elements without a standard atomic weight use the mass number of their longest-lived isotope, shown in brackets.
How do I find the mass percent of an element in a compound?
Divide the total mass of that element in the formula by the molar mass and multiply by 100. Oxygen in water is 15.999 / 18.015 = 88.81%. The table lists this for every element.
Why does my formula give an error?
The usual causes are a lowercase first letter (co2 instead of CO2), an unknown symbol, or a bracket that is opened but not closed. The message says which part could not be read.
Is there an in-depth guide to the Molecular Weight Calculator?
Yes. “Molar Mass, Molarity, Dilutions and Half-Life: Lab Maths” covers the background, how it works, common pitfalls and worked examples. Read the full guide.
Related Tools You May Like
Free, in-browser tools that pair well with this one.