Home Calculators Categories Category: Science & Engineering

Molar Mass Calculator

This molar mass calculator finds the molar mass in g/mol from a chemical formula using standard atomic weights. Type a formula such as H2SO4, Ca(OH)2, or CuSO4·5H2O to see each element's atom count and mass contribution. In Advanced mode you can see the elemental mass percentages and convert between moles and grams, so you can go from a formula to a quantity you can weigh out.

Input
Enter one formula. For nested groups, match each opening parenthesis or bracket with its closing symbol.

Use element capitalization and a middle dot for hydrates, as in CuSO₄·5H₂O.

Choose an example to fill the chemical formula field.
Visual
Elemental mass share Enter a chemical formula to see each element’s share of the molar mass. Elemental mass share Percentages in Advanced
Output
Molar mass
—
Uses standard atomic weights
Calculation steps
  • —

How to use the molar mass calculator

Start with the Chemical formula field. It opens on H2O. The Example formulas menu offers Water, Sodium chloride (NaCl), Calcium hydroxide (Ca(OH)2), Copper sulfate pentahydrate (CuSO4·5H2O), Sulfuric acid (H2SO4), and Sodium acetate (CH3COONa). Choosing a preset fills only the formula field. If you then edit the text, the menu switches to Custom formula, and choosing Custom formula yourself keeps the current text in place for editing.

The calculator has two modes:

  • Simple shows the Molar mass, the per-element Calculation steps, and the Elemental mass share bar.
  • Advanced keeps the formula, the molar mass, and the bar, and replaces the steps list with an Elemental composition table and a Converted amount panel. The table lists each element's atoms, atomic weight, mass in g/mol, and mass percent.

For the default formula, the computed sum is 18.015 g/mol, and the main display reads 18.02 g/mol because the headline value always shows two decimal places.

Copy copies the formula and current results, including a valid conversion in Advanced. Export opens the print dialog, where you can save a PDF. Reset restores Water, Simple mode, the default conversion direction, and the default quantity of 1.

Formula for molar mass

The formula for molar mass is a sum over the elements in the compound. Let nin_i be the number of atoms of element ii per molecule or formula unit, and let AiA_i be the molar mass of those atoms in g/mol. At the precision used here, the numerical value of AiA_i is the element's dimensionless standard atomic weight. Each element contributes

Ci=ni×AiC_i = n_i \times A_i

and the molar mass is the total of those contributions:

M=∑iCi=∑iniAiM = \sum_i C_i = \sum_i n_i A_i

The result is in g/mol. Each element's mass percentage is its share of that total:

mass %i=100×CiM\text{mass \%}_i = 100 \times \frac{C_i}{M}

Mass percentages describe how the mass is divided, not how many atoms there are. In water, hydrogen supplies only about 11% of the mass even though two of the three atoms are hydrogen, because each oxygen atom is about 16 times heavier.

The calculation in four steps

  1. Read the formula and count the atoms of each element. Repeated appearances of an element are combined, and a multiplier after a bracket applies to everything inside it.
  2. Look up the atomic weight AiA_i for each element.
  3. Multiply each count by its atomic weight to get CiC_i.
  4. Add the contributions to get MM.

The calculator counts and combines atoms internally. In Simple mode, Calculation steps shows each element's count multiplied by its atomic weight, and Molar mass shows the sum.

Atomic weights used

The tool uses the Commission on Isotopic Abundances and Atomic Weights (CIAAW) Abridged Standard Atomic Weights 2024. The table lists all 118 elements in atomic-number order. The calculator uses the listed values for 84 elements and rejects formulas containing any of the other 34, which have no standard atomic weight.

Element Atomic weight
H 1.0080
He 4.0026
Li 6.94
Be 9.0122
B 10.81
C 12.011
N 14.007
O 15.999
F 18.998
Ne 20.180
Na 22.990
Mg 24.305
Al 26.982
Si 28.085
P 30.974
S 32.06
Cl 35.45
Ar 39.95
K 39.098
Ca 40.078
Sc 44.956
Ti 47.867
V 50.942
Cr 51.996
Mn 54.938
Fe 55.845
Co 58.933
Ni 58.693
Cu 63.546
Zn 65.38
Ga 69.723
Ge 72.630
As 74.922
Se 78.971
Br 79.904
Kr 83.798
Rb 85.468
Sr 87.62
Y 88.906
Zr 91.222
Nb 92.906
Mo 95.95
Tc No standard atomic weight
Ru 101.07
Rh 102.91
Pd 106.42
Ag 107.87
Cd 112.41
In 114.82
Sn 118.71
Sb 121.76
Te 127.60
I 126.90
Xe 131.29
Cs 132.91
Ba 137.33
La 138.91
Ce 140.12
Pr 140.91
Nd 144.24
Pm No standard atomic weight
Sm 150.36
Eu 151.96
Gd 157.25
Tb 158.93
Dy 162.50
Ho 164.93
Er 167.26
Tm 168.93
Yb 173.05
Lu 174.97
Hf 178.49
Ta 180.95
W 183.84
Re 186.21
Os 190.23
Ir 192.22
Pt 195.08
Au 196.97
Hg 200.59
Tl 204.38
Pb 207.2
Bi 208.98
Po No standard atomic weight
At No standard atomic weight
Rn No standard atomic weight
Fr No standard atomic weight
Ra No standard atomic weight
Ac No standard atomic weight
Th 232.04
Pa 231.04
U 238.03
Np No standard atomic weight
Pu No standard atomic weight
Am No standard atomic weight
Cm No standard atomic weight
Bk No standard atomic weight
Cf No standard atomic weight
Es No standard atomic weight
Fm No standard atomic weight
Md No standard atomic weight
No No standard atomic weight
Lr No standard atomic weight
Rf No standard atomic weight
Db No standard atomic weight
Sg No standard atomic weight
Bh No standard atomic weight
Hs No standard atomic weight
Mt No standard atomic weight
Ds No standard atomic weight
Rg No standard atomic weight
Cn No standard atomic weight
Nh No standard atomic weight
Fl No standard atomic weight
Mc No standard atomic weight
Lv No standard atomic weight
Ts No standard atomic weight
Og No standard atomic weight

These single values represent normal materials. Natural isotopic variability is not propagated, and samples enriched in a particular isotope are outside the tool's scope. Internally, the engine sums the tabulated weights scaled by 10,000 and divides the total by 10,000.

Worked examples

Molar mass of NaCl

Sodium chloride has one Na and one Cl per formula unit. Ionic compounds are counted by formula unit, so NaCl is the whole entry.

Element Atoms Atomic weight Mass (g/mol) Mass %
Na 1 22.990 22.9900 39.34%
Cl 1 35.45 35.4500 60.66%
M=22.990+35.45=58.440 g/molM = 22.990 + 35.45 = 58.440 \text{ g/mol}

The calculator displays 58.44 g/mol. If you need to calculate the molar mass of NaCl by hand, this is the whole method.

Molar mass of H2SO4

Sulfuric acid has 2 H, 1 S, and 4 O.

Element Atoms Atomic weight Mass (g/mol) Mass %
H 2 1.0080 2.0160 2.06%
S 1 32.06 32.0600 32.69%
O 4 15.999 63.9960 65.25%
M=2.0160+32.06+63.996=98.072 g/molM = 2.0160 + 32.06 + 63.996 = 98.072 \text{ g/mol}

The display reads 98.07 g/mol. Oxygen carries about two thirds of the mass.

Molar mass of sodium acetate

Sodium acetate is often written CH3COONa. The formula contains C and O twice each, in separate places, so the counts have to be combined. The calculator does this automatically.

Element Atoms Atomic weight Mass (g/mol) Mass %
C 2 12.011 24.0220 29.28%
H 3 1.0080 3.0240 3.69%
O 2 15.999 31.9980 39.01%
Na 1 22.990 22.9900 28.02%
M=24.022+3.024+31.998+22.990=82.034 g/molM = 24.022 + 3.024 + 31.998 + 22.990 = 82.034 \text{ g/mol}

The display reads 82.03 g/mol. You can type CH3COONa as shown, or the combined form C2H3O2Na, and get the same answer, since the engine merges repeated elements into one count.

Molar mass of Ca(OH)2

A subscript after a closing parenthesis multiplies every atom in the group. Ca(OH)2 therefore has 1 Ca, 2 O, and 2 H:

M=40.078+2(15.999)+2(1.0080)=74.092 g/molM = 40.078 + 2(15.999) + 2(1.0080) = 74.092 \text{ g/mol}

This displays as 74.09 g/mol. Square brackets work the same way and can be nested with parentheses.

Molar mass of CuSO4 and copper sulfate pentahydrate

Anhydrous copper sulfate and copper sulfate pentahydrate have molar masses that differ by more than 90 g/mol.

Anhydrous copper sulfate, CuSO4:

Element Atoms Atomic weight Mass (g/mol)
Cu 1 63.546 63.5460
S 1 32.06 32.0600
O 4 15.999 63.9960
M=63.546+32.06+63.996=159.602 g/molM = 63.546 + 32.06 + 63.996 = 159.602 \text{ g/mol}

The display reads 159.60 g/mol.

Copper sulfate pentahydrate, CuSO4·5H2O: the dot separates the salt from its water of crystallization, and the 5 multiplies the entire H2O term. The pentahydrate therefore has 1 Cu, 1 S, 9 O (four from sulfate and five from water), and 10 H.

Element Atoms Atomic weight Mass (g/mol) Mass %
Cu 1 63.546 63.5460 25.45%
S 1 32.06 32.0600 12.84%
O 9 15.999 143.9910 57.67%
H 10 1.0080 10.0800 4.04%
M=63.546+32.06+143.991+10.080=249.677 g/molM = 63.546 + 32.06 + 143.991 + 10.080 = 249.677 \text{ g/mol}

The display reads 249.68 g/mol. As a cross-check, add five waters to the anhydrous salt: 159.602+5×18.015=249.677159.602 + 5 \times 18.015 = 249.677. About 36% of the pentahydrate's mass is water of crystallization.

When weighing copper sulfate for a solution, check which form is on the label. Using the anhydrous molar mass for the pentahydrate would leave you short of copper by roughly 36%.

Writing formulas the calculator accepts

  • Capitalization matters. Co is cobalt, while CO is carbon and oxygen. Element symbols are case sensitive.
  • Subscripts can be ordinary digits or Unicode subscripts, such as H₂O. An omitted subscript means one. Counts must be positive whole numbers without leading zeros.
  • Groups use matched parentheses () or square brackets [], nested if needed. Empty or mismatched groups are invalid.
  • Hydrates and adducts are separated by a middle dot ·, a mathematical dot ⋅, or an asterisk *. A lowercase x followed by a positive integer also works. All of these are accepted for copper sulfate pentahydrate: CuSO4·5H2O, CuSO4⋅5H2O, CuSO4*5H2O, and CuSO4 x 5H2O. With a dot or asterisk, the coefficient may be left off and then defaults to one. Several separated terms can be combined.
  • Spaces are allowed at the edges of the formula and of each separated term, but not inside a term.

The following are outside the supported syntax: a plain period as a separator, a leading reaction coefficient on the first term, fractional subscripts, reaction equations, charge notation, and isotope labels.

Limits. A formula can have up to 160 characters, 24 nested levels of parentheses or brackets, and 1,000,000,000 total atoms after all multipliers. Unknown symbols are rejected. Thirty-four recognized elements have no standard atomic weight in the calculator (for example Tc, Pm, Po, Rn, Ra, Pu, and Og), and they are reported separately from unknown symbols.

A valid parse establishes composition only. The tool does not check whether the compound exists, work backward from a mass to a formula, or handle mixtures, concentrations, or experimentally measured molar masses.

Molar mass vs molecular weight

The terms are related but not identical.

  • Molar mass is mass per amount of substance, in g/mol.
  • Relative molecular mass, commonly called molecular weight, is dimensionless. It compares the mass of a molecule to a reference atomic mass unit.
  • Relative formula mass is the same idea applied to the atoms in a formula unit, as with ionic compounds.

At the precision used here, the numerical value of the relative mass equals the molar mass in g/mol for ordinary molecular calculations. Water's molecular weight is 18.015, and its molar mass is 18.015 g/mol. For an ionic compound such as NaCl, the counts are by formula unit, so the molar mass is per mole of formula units.

Molar to grams calculator: converting moles and grams

Switch to Advanced to use the converter. The Convert selector defaults to Moles to grams, with an Amount in moles field in mol. Choosing Grams to moles changes the label to Mass in grams, with g as the unit. The starting number is 1, and changing direction keeps the number you entered but reinterprets it in the new unit. Conversion is inactive in Simple mode.

The relationships are:

m=n×Mm = n \times M
n=mMn = \frac{m}{M}

where mm is the sample mass in grams, nn is the amount in moles, and MM is the molar mass in g/mol.

Moles to grams. How many grams are in 0.250 mol of NaCl?

m=0.250×58.440=14.61 gm = 0.250 \times 58.440 = 14.61 \text{ g}

Grams to moles. How many moles are in 10.00 g of H2SO4?

n=10.0098.072≈0.101966 moln = \frac{10.00}{98.072} \approx 0.101966 \text{ mol}

Hydrate. What mass of CuSO4·5H2O contains 2.5 mol of the compound?

m=2.5×249.677=624.1925 gm = 2.5 \times 249.677 = 624.1925 \text{ g}

The calculator displays 624.193 g.

Conversions use the molar mass before display rounding, so they are not computed from the rounded two-decimal figure. Results show up to six significant digits, and use scientific notation for positive results below 0.0001 or at or above 1,000,000,000.

Input rules. The amount accepts decimal or scientific notation of up to 100 characters after trimming. Zero is valid and converts to zero. Nonzero values must lie between 10−10010^{-100} and 101210^{12} inclusive, in the displayed input unit. Negative and nonfinite amounts are invalid.

Reading the results

Rounding. The main molar mass shows exactly two decimal places. Element contributions show up to four decimal places. Mass percentages show two decimal places, with any positive share below 0.005% displayed as <0.01%. Because each percentage is rounded individually, a column may total slightly off 100%. The copper sulfate anhydrous shares, 39.82%, 20.09%, and 40.10%, add to 100.01% for that reason.

The mass share bar. The Elemental mass share bar is a live stacked bar in both modes. Segment widths show each element's share of the total mass, and wide segments are labeled with their symbols. The Advanced table shows rounded percentages for all segments, including narrow ones.

Precision. The displayed digits describe the arithmetic, not the accuracy of a real sample. Atomic weights vary slightly in nature, and a real sample may differ in purity, hydration, or isotopic makeup.

Errors. If the formula is invalid, the field is highlighted with a specific error, the composition and bar are cleared, and the molar mass shows an em dash. If the formula is valid but the Advanced conversion input is invalid, only the conversion result becomes an em dash, and the molar mass, composition, and bar stay available.

Common mistakes to avoid

  • Writing CO when you mean Co, or the reverse.
  • Forgetting that a hydrate coefficient multiplies the whole water term, atoms of both hydrogen and oxygen.
  • Using the anhydrous molar mass for a hydrated reagent.
  • Typing charges, such as SO4^2- or Cu2+, which the formula field does not support.
  • Typing a plain period in a hydrate, as in CuSO4.5H2O. Use ·, ⋅, *, or x.
  • Mixing up mass percent with atom percent.

Frequently asked questions

What is the molar mass of CuSO4?

Anhydrous CuSO4 is 159.602 g/mol, which displays as 159.60 g/mol. The pentahydrate, CuSO4·5H2O, is 249.677 g/mol, displayed as 249.68 g/mol.

How do I calculate the molar mass of NaCl?

Add the atomic weights of one sodium atom and one chlorine atom: 22.990+35.45=58.44022.990 + 35.45 = 58.440 g/mol.

How do I calculate the molar mass of H2SO4?

Count 2 H, 1 S, and 4 O, multiply each count by its atomic weight, and add: 2.0160+32.06+63.996=98.0722.0160 + 32.06 + 63.996 = 98.072 g/mol.

How do I calculate the molar mass of sodium acetate?

Combine the repeated elements in CH3COONa to get C2H3O2Na, then sum: 82.034 g/mol, displayed as 82.03 g/mol.

How do I enter a hydrate?

Separate the terms with ·, ⋅, or *, or write x followed by the coefficient. For example, CuSO4·5H2O and CuSO4 x 5H2O are equivalent.

Is molecular weight the same as molar mass?

Numerically they agree at this precision for ordinary molecular calculations, but molecular weight is dimensionless and molar mass is in g/mol.

Can this tool convert grams to moles?

Yes. In Advanced mode, choose Grams to moles, enter the mass in grams, and the tool divides by the molar mass.

Does it work for ions or isotopes?

No. Charge notation and isotope labels are not supported, and the tool uses standard atomic weights for normal materials.

Why does the main result show 18.02 when the sum is 18.015?

The headline molar mass is always rounded to two decimal places. Conversions and mass percentages use the unrounded sum.

Calculation Methodology Documented

Read the formula definitions, supported input ranges, and limitations before using this estimate.

Review Methodology
Debjeet Bhowmick
Author Debjeet Bhowmick AWS Certified Solutions Architect • Cloud & DevOps Consultant

AWS Certified Solutions Architect Professional and Senior Cloud & DevOps Consultant with over 14 years of hands-on expertise architecting resilient cloud infrastructure across AWS, GCP, and Azure. Specializes in infrastructure as code, continuous delivery automation, and telemetry across Terraform, Ansible, Docker, Kubernetes, ELK, Python, and SQL. Creator of OrangeCalc, delivering client-side high-precision computational tools.