=Calculator24

Science calculator

Molecular Weight Calculator

Parse a chemical formula and calculate molar mass, elemental composition and sample amount.

Inputs

Your numbers

Live

Instant result. Updates while you type.

Your result

Updated now

Enter your numbers.

Complete guide

Molecular weight and molar mass calculator from a chemical formula

Enter a formula such as H2O, Ca(OH)2 or CuSO4·5H2O. Calculator24 parses element counts, sums molar mass, reports mass percentages and converts the optional sample mass to moles and entities.

Editorial checkFormula tokenizer, nested groups, hydrate coefficients and elemental mass contributions tested against common compounds.Updated September 11, 2026
A formula is a weighted sum of its atomsEach element count multiplies its relative atomic mass; the contributions add to the compound molar mass.1Formula tokens2Element contributions3Molar mass
A formula is a weighted sum of its atomsEach element count multiplies its relative atomic mass; the contributions add to the compound 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.

Formula notation examples

Plain digits are accepted instead of typographic subscripts.
FormulaParsed composition
H2OH₂O
Ca(OH)2CaO₂H₂
Al2(SO4)3Al₂S₃O₁₂
CuSO4·5H2OCuS 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.

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 display up to 8 decimal places; exported numbers preserve calculation precision. This is a calculation summary, not an official certificate.

Sources and references

Keep exploring