Home › Chemistry › Molar Mass Calculator
Molar Mass Calculator
Parses a chemical formula (including brackets, nested groups and hydrates) and sums IUPAC 2021 standard atomic weights to give the molar mass in g/mol, plus the atom count and mass-percent composition of each element.
When to use
You have a chemical formula and need its molar mass (molecular weight), the number of atoms of each element, or its elemental mass-percent composition.
Do not use when: You already know the molar mass and want to convert between grams and moles (use moles-mass) or need a solution concentration (use molarity).
Formula
molar_mass = Σ (atomic_weight_i × count_i); mass_fraction_percent_i = 100 × atomic_weight_i × count_i / molar_mass
Atomic weights are the IUPAC 2021 abridged standard values (conventional values for elements whose weight is given as an interval, e.g. H 1.008, C 12.011, O 15.999, S 32.06, Cl 35.45); the result is therefore reproducible to 3 decimals but not identical to tables using more digits. Radioactive elements without a standard atomic weight use the mass number of their longest-lived isotope.
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
formula | string | yes | Chemical formula with case-sensitive element symbols, integer subscripts, brackets and optional hydrate dot, e.g. C6H12O6, Ca(OH)2, Fe2(SO4)3, CuSO4·5H2O. A trailing charge (NH4+, SO4^2-) or state (aq) is ignored. |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
molar_mass_g_mol | number | g/mol | Sum of atomic weight × atom count over all elements. |
molecular_mass_da | number | Da | Same value expressed in daltons (unified atomic mass units) per molecule or formula unit. |
atom_count | integer | Total number of atoms in one formula unit. | |
element_count | integer | Number of distinct elements in the formula. | |
composition | list | Per element: symbol, atom count, atomic weight, contributed mass (g/mol) and mass fraction in percent. |
Example
Glucose C6H12O6: {"formula":"C6H12O6"} → {"molar_mass_g_mol":180.156,"atom_count":24,"element_count":3,"composition":[{"element":"C","count":6,"mass_fraction_percent":40.002},{"element":"H","count":12,"mass_fraction_percent":6.714},{"element":"O","count":6,"mass_fraction_percent":53.284}]}
Copper(II) sulfate pentahydrate CuSO4·5H2O: {"formula":"CuSO4·5H2O"} → {"molar_mass_g_mol":249.677,"atom_count":21,"element_count":4}
GET https://tttkmbb.com/api/v1/calculate/molar-mass?formula=C6H12O6
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/molar-mass(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/molar-mass · Markdown: https://tttkmbb.com/chemistry/molar-mass.md · JSON definition: https://tttkmbb.com/chemistry/molar-mass.json
- MCP: server
https://tttkmbb.com/mcp, toolcalculate_molar_mass - OpenAPI operationId:
calculate_molar_mass - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
FAQ
Which atomic weights are used?
IUPAC 2021 standard atomic weights abridged to five significant figures (H 1.008, C 12.011, N 14.007, O 15.999, Na 22.990, Cl 35.45, Fe 55.845). Textbooks using more digits or older tables may differ in the third decimal.
Can I enter ions, hydrates or states?
Yes: NH4+, NO3-, SO4^2- or 'CO3 2-' drop the charge (electron mass is negligible), CuSO4·5H2O (also written CuSO4.5H2O or CuSO4*5H2O) adds five waters, and (aq)/(s)/(l)/(g) is ignored. Write multi-digit charges as Fe^3+ or 'Fe 3+', because Fe3+ is read as three iron atoms.
Why is my formula rejected?
Element symbols are case-sensitive (Co ≠ CO, nacl is invalid), subscripts must be positive integers, and every opening bracket needs a closing one. Structural notation such as CH3-CH2-OH is not parsed; write C2H6O instead.
Related calculators
- Moles to Grams Calculator — Convert grams of this substance to moles and number of molecules.
- Molarity Calculator — Turn a mass of this compound into a solution concentration.
- Mass Percent Calculator — Mass percent of a solute in a solution rather than of an element in a compound.