Molar mass calculator for any chemical formula
This molar mass calculator reads a chemical formula the way a chemist writes it and returns the molar mass in grams per mole. It understands nested brackets such as Al2(SO4)3 and [Fe(CN)6]^4-, hydrates written with a dot or middle dot such as CuSO4·5H2O, ionic charges, and state labels like (aq). The result comes with a percent-composition table, a three-way converter between grams, moles and formula units, and a molarity calculator for making up solutions.
Atomic masses are the IUPAC 2021 abridged conventional values (H 1.008, C 12.011, O 15.999, Cl 35.45), so answers match textbooks and marking schemes: water is 18.015 g/mol.
Students check stoichiometry homework, lab workers weigh out reagents and teachers build composition tables — all in your browser.
How to use the Molar Mass Calculator
- Type the formula in the box, or press one of the example buttons. Keep element symbols capitalised correctly: Co is cobalt, CO is carbon monoxide.
- Use ( ), [ ] or { } for groups with the subscript after the bracket (
K4[Fe(CN)6]), and a dot for hydrates (MgSO4·7H2O). - Read the molar mass in the result panel and the per-element breakdown in the table; press Copy table to paste it elsewhere.
- Enter a mass in grams, an amount in moles or a number of formula units and the other two values are filled in.
- In the Molarity calculator, choose what to find — molarity, mass to weigh, final volume, or mg/mL to M — and fill in the other boxes. Type a molecular weight to override the formula, for example for a protein.
Molar Mass Calculator features
Full periodic table built in
All 118 elements with names and atomic masses are embedded; radioactive elements use the mass number of their longest-lived isotope and the result says so.
Brackets, hydrates and charges
Nested parentheses, square brackets, dotted hydrates with decimal coefficients and trailing charges such as ^2- or 3+ are parsed correctly.
Percent composition
Each element's atom count, atomic mass, contribution in g/mol and mass percent are tabulated, with a total row.
Grams ↔ moles ↔ molecules
Edit any of the three fields; the others update using the molar mass and the Avogadro constant 6.02214076 × 10²³.
Clear error messages
A lowercase start, an unknown symbol or an unclosed bracket produces a message pointing at the exact problem instead of a wrong answer.
Molarity, mg/mL and molality
Solve molarity, grams to weigh or final volume, convert mg/mL to M, and read % w/v, millimoles and molality in one panel.
How molar mass is calculated
Molar mass is the sum of the atomic masses of every atom in the formula, water of crystallisation included. An ionic charge is reported but not subtracted (see the FAQ).
Worked example for copper(II) sulfate pentahydrate, CuSO4·5H2O: copper 63.546, sulfur 32.06, four oxygens 4 × 15.999 = 63.996, and five waters 5 × 18.015 = 90.075. Adding these gives 249.677 g/mol. The mass percent of water is 90.075 ÷ 249.677 = 36.08 %.
| Compound | Formula | Molar mass (g/mol) |
|---|---|---|
| Water | H2O | 18.015 |
| Sodium chloride | NaCl | 58.44 |
| Glucose | C6H12O6 | 180.156 |
| Calcium hydroxide | Ca(OH)2 | 74.092 |
| Magnesium phosphate | Mg3(PO4)2 | 262.855 |
| Copper(II) sulfate pentahydrate | CuSO4·5H2O | 249.677 |
| Sulfuric acid | H2SO4 | 98.072 |
Moles, grams and molecules
The conversions use n = m ÷ M (moles equal mass divided by molar mass) and N = n × NA (number of particles equals moles times the Avogadro constant). The chemical equation balancer converts the moles of one substance in a reaction into grams of another.
- Molecular mass vs molar mass: numerically the same, but molecular (or formula) mass is in unified atomic mass units per molecule and molar mass is in grams per mole.
- Formula units: for ionic compounds such as NaCl the converter counts formula units, not molecules.
Molarity calculator: mass, volume, mg/mL and molality
Molarity is moles of solute per litre of final solution: M = (mass ÷ molar mass) ÷ volume. To prepare 250 mL of 0.1 M NaCl you need 0.1 × 0.250 = 0.025 mol, or 0.025 × 58.44 = 1.461 g, dissolved and made up to 250 mL in a volumetric flask. A concentration in mg/mL equals g/L, so dividing it by the molar mass gives mol/L: 1 mg/mL of bovine serum albumin (66,430 g/mol) is 15.05 µM. Percent w/v is grams per 100 mL, so 5.844 g/L of NaCl is 0.5844 %.
- Molality (mol per kg of solvent) does not change with temperature; enter the solvent mass to see it. For dilute water solutions it is close to molarity.
- Normality multiplies molarity by the n-factor of the reaction — use the normality calculator. To dilute a stock (C1V1 = C2V2) or convert to ppm, use the dilution calculator.
Formula syntax accepted
- Groups in ( ), [ ] or { } nested to any depth:
C12H22O11,Al2(SO4)3. - Hydrates and adducts:
Na2CO3·10H2O,CaSO4.0.5H2O(decimal coefficients are allowed). - Charges at the end:
NH4+,SO4^2-,Fe^3+,PO4(3-). A multi-unit charge needs the ^ or brackets so that NH4+ is not read as NH with charge 4. - State symbols
(s),(l),(g),(aq)at the end are ignored.
Molar Mass Calculator FAQ
How do I calculate the molar mass of a compound by hand?
Count the atoms of each element, multiply each count by the element's atomic mass from the periodic table, and add the products. For NaCl that is 22.990 + 35.45 = 58.44 g/mol.
What is the molar mass of water?
18.015 g/mol: two hydrogens at 1.008 plus one oxygen at 15.999. One mole of water therefore weighs 18.015 g and contains 6.022 × 10²³ molecules.
How do I calculate molarity from mass and volume?
Divide the mass by the molar mass to get moles, then divide by the volume in litres. 5.844 g of NaCl (58.44 g/mol) made up to 1 L is 0.100 M; in 500 mL it would be 0.200 M.
Does an ionic charge change the molar mass?
Only by the mass of the electrons, about 0.00055 g/mol per unit of charge, which is below the precision of the atomic masses. The charge is shown for reference but not subtracted.
Which atomic masses are used?
The IUPAC 2021 abridged conventional values, for example C 12.011, O 15.999, Cl 35.45, Cu 63.546. Elements without a stable isotope, such as technetium or uranium's neighbours, use the mass number of their most stable isotope and the result is flagged.
Can I convert grams to moles for a hydrate?
Yes. Enter the hydrate formula so the water is included in the molar mass, then type the mass in grams. 24.97 g of CuSO4·5H2O is 0.100 mol.