Education
Molecular Weight Calculator
Type a chemical formula and the calculator parses every element, sums the atomic weights, and returns molar mass in g/mol with a per-element mass and percent-composition breakdown.
Element symbols are case-sensitive (Na, not NA). Subscripts are digits after the symbol. Parentheses with multipliers are supported. · e.g. H2O, CO2, NaCl, C6H12O6, Ca(OH)2
What this parser supports
- Element symbols from H (hydrogen) through Pu (plutonium).
- Numeric subscripts directly after a symbol, e.g. H2O.
- Parentheses and square brackets with numeric multipliers, e.g. Ca(OH)2 or Mg3(PO4)2.
- Nested groups, e.g. K3[Fe(CN)6].
Not supported: charge notation (e.g. NH4+), hydrate dots (CuSO4·5H2O), isotope labels, or organic shorthand (CH3 in Lewis structure form). Educational use only; do not rely on this for laboratory dosing or safety decisions.
Molecular weight of H2O
18.015 g/mol
3 atoms total
Molar mass equals the sum, over each element, of the atom count times the standard atomic weight. Values are the IUPAC 2021 conventional weights in g/mol. The percent column shows mass composition by element.
Examples
H2O (water)
18.015 g/mol
CO2 (carbon dioxide)
44.009 g/mol
NaCl (table salt)
58.44 g/mol
C6H12O6 (glucose)
180.156 g/mol
Ca(OH)2 (calcium hydroxide)
74.093 g/mol
K3[Fe(CN)6] (potassium ferricyanide)
329.244 g/mol
How it works
The parser walks the formula one symbol at a time, expanding any parenthesized group by its subscript and accumulating atom counts per element. Molar mass is then the sum, over every element, of count × atomic weight.
Molar mass · M = Σ n_i × A_i
n_i = atom count for element i, A_i = standard atomic weight (g/mol).
Percent composition for each element is mass(element) / mass(total) × 100, useful for converting between mass and moles and for stoichiometric ratios.
Related education calculators
- Grams to moles calculator for the next stoichiometry step once you have the molar mass.
- Molarity calculator for solution concentration in mol/L.
- Percent yield calculator for actual-vs-theoretical reaction yield.
- Balancing equations calculator for finding chemical-equation coefficients.
- All education calculators.
Educational use only. The parser is built for homework and classroom problems. Do not use this output for laboratory dosing, drug formulation, chemical safety, or any decision where exact masses matter.
Frequently asked questions
Molar mass is the mass of one mole of a substance, expressed in grams per mole (g/mol). For a molecule, it equals the sum of the atomic weights of every atom in the formula. The terms 'molecular weight' and 'molar mass' are used interchangeably for ordinary molecules.
Count the atoms of each element in the formula, multiply each by the standard atomic weight of that element, and add the results. For example, H2O has 2 hydrogens (2 × 1.008 = 2.016) and 1 oxygen (1 × 15.999 = 15.999), so molar mass = 18.015 g/mol.
Standard atomic weights from the IUPAC 2021 conventional values, expressed in grams per mole. For some elements without a stable isotope (Tc, Pm, Po, At, Rn, Fr, Ra, Ac, Np, Pu), the calculator uses the mass number of the most stable common isotope.
Element symbols (case-sensitive: Na not NA), digit subscripts (H2O, CO2), nested parentheses with multipliers (Ca(OH)2, Mg3(PO4)2), and square brackets (K3[Fe(CN)6]). Spaces are ignored.
Charges (NH4+ or SO4^2-), hydrate dots (CuSO4·5H2O — instead enter the combined formula), isotope notation (^14C), and organic Lewis shorthand. Multi-letter symbols must start with a capital and be followed by lowercase: Ca, not CA or ca.
The numbers are based on the latest published atomic weights and are fine for stoichiometry homework, lab prep estimates, and routine analytical chemistry. For ultra-precise mass spectrometry or radiochemistry, use isotope-specific masses from a primary source.
Molar mass is mass per mole (g/mol). Molecular mass is the mass of a single molecule in atomic mass units (u or Da). Numerically the values match (one molecule of water is 18.015 u; one mole is 18.015 g), so most introductory chemistry courses use the terms interchangeably.
Related calculators
Education
Final Grade Calculator
Calculate your final course grade from your current grade and your final exam score.
Education
Weighted Grade Calculator
Combine assignments, quizzes, and exams by weight to get a precise weighted course average.
Education
Final Exam Calculator
Find out exactly what you need to score on your final exam to hit your target course grade.