Molar Mass Calculator

Calculate molecular weight from any chemical formula

A molar mass calculator computes the molecular weight of a compound from its chemical formula by summing the atomic masses of all constituent atoms. Enter any formula — from simple H2O to complex organic molecules like C6H12O6 — and instantly get the molar mass in g/mol along with a full element breakdown and mass percent composition.

Chemical Formula

Common Compounds

How to Use the Molar Mass Calculator

The molar mass calculator parses any chemical formula and sums the atomic masses of each element to give the molecular weight in grams per mole (g/mol). This is one of the most fundamental calculations in chemistry, needed for stoichiometry, molarity calculations, percent composition, and laboratory preparation of solutions.

Step 1: Enter Your Chemical Formula

Type the chemical formula in the input field using standard notation. Element symbols must be capitalized correctly — for example NaCl for sodium chloride (not nacl), and Ca(OH)2 for calcium hydroxide. Use parentheses for polyatomic groups followed by their subscript, just as you would write them on paper.

Step 2: Use a Preset for Common Compounds

Click any preset button to instantly load a common formula: water (H2O), table salt (NaCl), glucose (C6H12O6), ethanol (C2H5OH), calcium hydroxide Ca(OH)2, aspirin (C9H8O4), caffeine (C8H10N4O2), or aluminum sulfate Al2(SO4)3. These presets demonstrate how different formula types are parsed and can serve as starting points for similar compounds.

Step 3: Review the Molar Mass and Breakdown

After clicking Calculate, the molar mass appears in g/mol. The element breakdown table shows each element in the formula, the number of atoms, the standard atomic mass from the IUPAC periodic table, the contribution of that element to the total mass, and the mass percent. This lets you verify the calculation and understand the chemical composition at a glance.

Reading the Mass Composition Bar

The visual composition bar below the table shows each element as a proportional colored segment. Elements that make up a larger fraction of the mass take up more space. A legend below maps each color to its element symbol and mass percentage. This visual representation is especially useful for comparing the composition of similar compounds.

Formula Parsing Rules

The parser handles all standard chemical formula notations: simple formulas (H2O, CO2), ionic compounds (NaCl, MgCl2), compounds with parenthetical groups (Ca(OH)2, Al2(SO4)3), and long organic formulas (C12H22O11 for sucrose). Multi-character element symbols like Cl, Br, Ca, Na, Fe, Cu, Zn, and Au are all recognized. Numbers immediately after an element or closing parenthesis are treated as subscripts.

Frequently Asked Questions

Is this molar mass calculator free to use?

Yes, this molar mass calculator is completely free. All formula parsing and atomic mass lookups happen locally in your browser. No signup, no account, and no data is ever transmitted to any server.

Is my data private when using this tool?

Absolutely. Every calculation runs entirely in your web browser using JavaScript. Nothing you type is sent anywhere. Your data remains 100% private on your device.

What is molar mass and how is it calculated?

Molar mass is the mass of one mole of a substance, expressed in grams per mole (g/mol). It is calculated by summing the atomic masses of all atoms in a molecule. For H2O: 2 × 1.008 (H) + 1 × 15.999 (O) = 18.015 g/mol.

What chemical formula formats does this calculator accept?

The calculator accepts standard chemical formulas including subscripts (H2O, NaCl), parentheses for groups (Ca(OH)2, Al2(SO4)3), nested parentheses, and hydrates using a dot notation. Element symbols must use proper capitalization (e.g., Na, not na or NA).

Does it support formulas with parentheses like Ca(OH)2?

Yes. The parser handles parentheses and multipliers correctly. Ca(OH)2 is parsed as Ca + 2×O + 2×H = 40.078 + 2×15.999 + 2×1.008 = 74.093 g/mol. Nested parentheses and multi-digit subscripts are also supported.

What atomic masses does this calculator use?

The calculator uses the standard atomic weights published by the International Union of Pure and Applied Chemistry (IUPAC). These are the accepted values used in chemistry textbooks and professional practice worldwide.

What is mass percent composition and why does it matter?

Mass percent composition shows what fraction of a compound's total mass comes from each element. For NaCl, sodium contributes 39.3% and chlorine 60.7% by mass. This is useful in analytical chemistry for identifying compounds and in industry for calculating reagent quantities.

Can I calculate the molar mass of organic compounds like glucose?

Yes. Enter C6H12O6 for glucose (180.156 g/mol), C2H5OH for ethanol (46.068 g/mol), or C9H8O4 for aspirin (180.159 g/mol). The calculator handles any compound as long as you enter a valid chemical formula with correct element symbols and capitalization.