Molar Mass Calculator

By: Calculator Grid

Molar mass calculator

Parse a chemical formula, total its elemental masses, and convert between sample mass and amount of substance.

C₆H₁₂O₆24 atoms per formula unit3 elements
Workbook ready for the demonstration example.

Inputs

Supports element symbols, integer subscripts, parentheses, brackets, and hydrate dots, for example Ca(OH)2 or CuSO4·5H2O.
Optional nonnegative decimal in grams; used to calculate moles and molecule count.

Results

Molar mass
180.156 g/mol
Amount of substance
0.13877 mol
Molecules / formula units
8.357 × 10²²
Total atoms
2.006 × 10²⁴
Largest mass contributor
Oxygen · 53.29%
Molar mass 180.156 grams per mole.

Elemental composition

Element Symbol Atom count Atomic weight Mass contribution Mass percent
Carbon C 6 12.011 72.066 g/mol 40.00%
Hydrogen H 12 1.008 12.096 g/mol 6.71%
Oxygen O 6 15.999 95.994 g/mol 53.29%
Atomic weights are conventional or abridged values suitable for routine calculations. Isotopic composition can change the exact molar mass of a specific sample.

How to use this molar mass calculator

What this calculator does. It converts a chemical formula into molar mass by identifying each element, counting its atoms, multiplying each count by the element's atomic weight, and summing the contributions. When a sample mass is supplied, it also estimates the amount of substance in moles, the corresponding number of molecules or formula units, and the total number of atoms represented. It does not determine a compound's structure, purity, isotopic composition, reaction yield, or whether a typed formula represents a stable real substance.

When to use it. This tool is useful for preparing a solution from a target number of moles, checking stoichiometric homework, converting a weighed laboratory sample into moles, or comparing which elements dominate a compound's mass. The underlying atomic-weight concept follows the values maintained by the IUPAC periodic table of the elements.

How to calculate. The calculator opens with glucose, C6H12O6, and a 25 g sample so every result and the example Excel workbook are ready immediately.

  1. Replace Chemical formula with the formula you want to analyze. Use correct capitalization: Co means cobalt, while CO means carbon monoxide. Parentheses and brackets may be nested, and a middle dot or period may separate hydrate groups.
  2. Optionally replace Sample mass (g) with a nonnegative decimal mass. Leave it blank when you only need molar mass and elemental composition.
  3. Read Molar mass first, then review the mole, entity, atom, and composition outputs. Select Download Excel to export the current validated model. Reset clears the demonstration data and disables export until a complete valid formula is entered again.

Input guide. Chemical formula is required text. It accepts element symbols, positive integer subscripts, parentheses, square brackets, and hydrate separators, such as Ca(OH)2, Al2(SO4)3, or CuSO4·5H2O. A missing subscript means one atom. Unsupported element symbols, zero subscripts, unmatched brackets, decimal subscripts, charges, and stray punctuation are rejected rather than silently ignored. Sample mass (g) is optional and accepts an en-US decimal such as 25 or 1,250.5; it must be finite and nonnegative. Increasing sample mass leaves molar mass unchanged but increases moles, entities, and total atoms proportionally.

Output guide. Molar mass is the sum of atomic-weight contributions in grams per mole. Amount of substance is sample mass divided by molar mass. Molecules / formula units multiplies moles by the Avogadro constant; the wording covers molecular and ionic substances. Total atoms multiplies the entity count by the number of atoms in one formula unit. Largest mass contributor identifies the element with the greatest percentage of the formula's total mass. The Elemental composition table reports each element's atom count, atomic weight, contribution in g/mol, and mass percentage. These are calculated identities based on the chosen atomic-weight table, not experimental measurements of a particular sample.

Worked example. For glucose, C6H12O6, the contribution is 6 × 12.011 for carbon, 12 × 1.008 for hydrogen, and 6 × 15.999 for oxygen. Adding 72.066 + 12.096 + 95.994 gives 180.156 g/mol. A 25 g sample therefore contains 25 ÷ 180.156 = 0.13877 mol, about 8.357 × 10²² molecules, and because each molecule has 24 atoms, about 2.006 × 10²⁴ atoms. For comparison data on known species, the NIST Chemistry WebBook formula search provides molecular-weight records and other chemical-property data.

Formula and atomic-weight method

M = Σ(nᵢ × Aᵣ,ᵢ) and n = m ÷ M

The parser expands grouped formulas before summing. In Ca(OH)2, for example, the outside 2 multiplies both oxygen and hydrogen. In CuSO4·5H2O, the hydrate coefficient multiplies the entire water group. Standard atomic weights can vary with natural isotopic composition, so high-precision isotope work should use sample-specific isotope abundances rather than a single conventional value. The CIAAW standard atomic-weight table explains the current recommended values and interval notation.

Interpretation and common mistakes

Molar mass is numerically equal to relative formula mass but carries the unit g/mol. Keep element symbols case-sensitive, apply every closing-group multiplier, and distinguish coefficients from subscripts: 5H2O means five water units, whereas H10O5 is the expanded atom count. A zero sample mass is valid and produces zero moles and entities; a blank sample mass simply omits those sample-dependent results. For background on how molecular weights are reported in a reference database, see the NIST Chemistry WebBook FAQ.