Molecular weight and molar mass calculator from a chemical formula
Molar mass is the sum of each atom's atomic weight times how many times it appears. Water, H2O, is 2 × 1.008 + 15.999 = 18.015 g/mol; glucose, C6H12O6, is 180.156 g/mol. Type any formula, including parentheses and hydrates such as CuSO4·5H2O, to get the molar mass, mass percent of each element and moles in a sample.
Inputs used by this calculator
Molecular Weight Calculator uses the fields below. The starting values reproduce the page example; replace them with values from the same units and time period before using the result.
| Input | Starting example | Accepted value | How it is used |
|---|---|---|---|
| Chemical formula | C6H12O6 | Text in the format shown | Supplies the chemical formula quantity used by the published equation or result breakdown. |
| Optional sample mass (g) | 180.156 | 0 to 1000000000000 | Supplies the optional sample mass (g) quantity used by the published equation or result breakdown. |
- Formula tokens
- Element contributions
- Molar mass
Relative molecular mass and molar mass
Relative molecular mass is dimensionless. For a defined composition, the same numerical value expressed in g/mol gives its molar mass.
How the formula is parsed
Capital letters begin element symbols, lowercase letters complete them, whole numbers multiply the preceding element or parenthesized group, and a hydrate coefficient multiplies its dot-separated component.
Mass-sum formula
The engine multiplies each element count by its stored representative relative atomic mass and adds the contributions.
M=ΣNᵢAᵣ,ᵢWorked glucose example
C6H12O6 contains 6 carbon, 12 hydrogen and 6 oxygen atoms. Their contributions sum to approximately 180.156 g/mol.
From grams to amount
Dividing sample mass by molar mass gives moles. Multiplying moles by the exact Avogadro constant gives the number of specified formula entities.
Isotopes and material limits
Atomic weights can be intervals because natural isotopic composition varies. This general calculator uses representative values and does not model isotopic labels, mixtures, charges, polymers or non-stoichiometric solids.
Molar masses of common compounds
| Compound | Formula | Molar mass |
|---|---|---|
| Water | H2O | 18.015 g/mol |
| Carbon dioxide | CO2 | 44.009 g/mol |
| Oxygen gas | O2 | 31.998 g/mol |
| Sodium chloride (table salt) | NaCl | 58.440 g/mol |
| Ammonia | NH3 | 17.031 g/mol |
| Methane | CH4 | 16.043 g/mol |
| Ethanol | C2H5OH | 46.069 g/mol |
| Acetic acid (vinegar) | CH3COOH | 60.052 g/mol |
| Sodium bicarbonate (baking soda) | NaHCO3 | 84.006 g/mol |
| Calcium carbonate | CaCO3 | 100.086 g/mol |
| Sulfuric acid | H2SO4 | 98.072 g/mol |
| Glucose | C6H12O6 | 180.156 g/mol |
| Aspirin | C9H8O4 | 180.159 g/mol |
| Sucrose (table sugar) | C12H22O11 | 342.297 g/mol |
| Copper(II) sulfate pentahydrate | CuSO4·5H2O | 249.677 g/mol |
Formula notation examples
| Formula | Parsed composition |
|---|---|
| H2O | H₂O |
| Ca(OH)2 | CaO₂H₂ |
| Al2(SO4)3 | Al₂S₃O₁₂ |
| CuSO4·5H2O | CuS O₉ H₁₀ |
Frequently asked questions
Is molecular weight the same as molar mass?
They share a numerical value for a defined composition, but relative molecular mass is dimensionless and molar mass has units.
Can I use parentheses?
Yes, including nested groups within the supported length.
Can I enter hydrates?
Yes, separate components with a middle dot or period.
Are isotopically labeled formulas supported?
No.
Why can published values differ slightly?
Atomic-weight conventions and isotopic composition can differ. In 2024 IUPAC revised the standard atomic weights of gadolinium (157.249), lutetium (174.96669) and zirconium (91.222); this calculator uses the revised values.
What is the molar mass of water?
18.015 g/mol, from two hydrogen atoms (1.008 each) and one oxygen atom (15.999).
How are sample moles calculated?
Sample mass in grams divided by molar mass in g/mol.
What to keep in mind
Uses conventional representative relative atomic-mass values for natural terrestrial composition. Isotopic enrichment, uncertain radioactive-element mass numbers, charges, polymers and non-stoichiometric materials require a composition-specific method.
Results are rounded for display in US format, with money in dollars and cents; CSV exports keep full calculation precision. This is a calculation summary, not an official certificate.