Enter a chemical formula and press "Calculate". You get the molar mass (molecular weight), a breakdown by element (count, atomic weight, mass and mass percent) and a pie chart of the mass composition.
Table of Contents
-
What you can do on this page
-
What is this calculation used for?
-
How to Use
-
Formulas and figures
-
Symbols and terms
-
Good to know before you start
-
How to calculate it in Excel
-
How to calculate it in Google Sheets
-
How to calculate it in Python
-
How to write it in LaTeX and other math languages (copy and paste)
-
How to have ChatGPT do the calculation
-
DataChef Features
-
Related Features
-
NumberChef Calculators List
What you can do on this page
- Just type a chemical formula (for example, \(\mathrm{H_2O}\) or \(\mathrm{Al_2(SO_4)_3}\)) to get the molar mass (molecular weight, g/mol) on the spot
- A breakdown table by element (count, atomic weight, mass and mass percent) and a pie chart of the mass composition are shown at the same time
- Nested parentheses () and brackets [] and hydrates written with a dot (for example, CuSO4.5H2O) are supported
- A plain-language explanation of the formulas and copy-and-paste formulas for Excel, Google Sheets and Python are all on this page
What is this calculation used for?
To make 1 L of 0.1 mol/L salt water, the sodium chloride you need is molar mass (formula mass) 58.44 × 0.1 mol = about 5.84 g.
In chemistry, biology and pharmacy labs, every time you make a solution you convert "moles × molar mass = grams to weigh out", so the molar mass is a number used every day.
When choosing candidate molecules for a pill, the pharmaceutical industry often uses "molecular weight of 500 or less" as one guideline (Lipinski's rule of five; molecules that are too large are harder for the body to absorb).
For researchers narrowing down new drug candidates, the molecular weight is one of the first basic numbers they check.
Urea \(\mathrm{CH_4N_2O}\) (molecular weight 60.056), a common nitrogen fertilizer, is \(28.014 \div 60.056 \times 100 \approx 46.6\%\) nitrogen by mass. The "46-0-0" (46% nitrogen) printed on a bag of urea comes from exactly this calculation.
When farmers and gardeners work out how much fertilizer they need to put a certain amount of nitrogen on a field, the mass percent formula is the foundation.
In the US, blood sugar is reported in mg/dL, while many other countries and many research papers use mmol/L. The conversion uses the molecular weight of glucose \(\mathrm{C_6H_{12}O_6}\), 180.156: the factor 18 in "mg/dL ÷ 18 ≈ mmol/L" comes from it (180.156 ÷ 10 ≈ 18).
It is an example of molecular weight working behind the scenes when lab values are compared between countries or when a meter switches its display units.
The environmental conversion factor "burning 1 ton of carbon gives about 3.67 tons of CO₂" comes from the molecular weight of \(\mathrm{CO_2}\), 44.009, divided by the atomic weight of carbon, 12.011, which is about 3.664. The mass goes up because oxygen joins the carbon as it burns.
This idea is used in company greenhouse gas reports and in carbon footprint calculations.
Formulas and figures
Symbols and terms
Symbols
| \(M\) | em | The molar mass (molecular weight): the sum of the atomic weights of all the atoms in the chemical formula. As a molar mass, its unit is g/mol (grams per mole). |
| \(w_i\) | w sub i | The atomic weight of element \(i\): the relative mass of one atom of that element, with carbon-12 set to 12. (Example - H is 1.008, O is 15.999) |
| \(n_i\) | n sub i | How many atoms of element \(i\) there are in the chemical formula. (Example - in \(\mathrm{H_2O}\), 2 of H and 1 of O) |
| \(\sum\) | sigma | A symbol that means "add them all up". Here it means adding atomic weight × count, calculated for each element, over all the elements. |
| \(P\) | pee | The mass percent of an element - the share of the compound's total mass that the element makes up, as a percentage (%). |
Terms
| atomic weight | The mass of one atom as a relative number, with the carbon-12 atom set to 12. Hydrogen is about 1.008 and oxygen about 15.999. It is the value shown on the periodic table (often labeled average atomic mass), and this calculator uses the abridged values from IUPAC (the International Union of Pure and Applied Chemistry). |
| molecular weight | The mass of one molecule on the same scale as the atomic weight. You find it by adding the atomic weights of all the atoms in the molecule. Like the atomic weight, it is a relative value, so it has no unit. |
| molar mass | The mass of 1 mol (6.02×10²³ particles) of a substance, in g/mol. The number is the same as the molecular weight (formula mass), so this page treats molecular weight and molar mass as the same calculation (for example, the molecular weight of water is 18.015, so its molar mass is 18.015 g/mol). |
| formula mass | Ionic compounds such as sodium chloride \(\mathrm{NaCl}\), and metals, do not form molecules at all. So instead of "molecular weight", the sum of the atomic weights in the empirical formula is called the formula mass (or formula weight). It is calculated in exactly the same way. |
| chemical formula | A way of writing what a substance is made of with element symbols and numbers. It covers molecular formulas (such as \(\mathrm{H_2O}\)) and empirical formulas (such as \(\mathrm{NaCl}\)). The small number at the lower right (the subscript) is the number of the atom (or bracketed group) just before it. |
| empirical formula | A formula that shows the kinds of atoms (or ions) in a substance and their ratio in the simplest whole numbers. Substances that do not form molecules, such as ionic compounds (for example, \(\mathrm{NaCl}\)) and metals, are written this way. |
| hydrate | A substance with water molecules (water of crystallization) inside its crystals. It is written with a dot (·) between the main part and the water, as in copper(II) sulfate pentahydrate \(\mathrm{CuSO_4 \cdot 5H_2O}\). When finding the molar mass, add the part after the dot as well. |
| mole (mol) | A unit that counts an amount by the number of particles (atoms or molecules). 1 mol is about 6.02×10²³ particles. Since mass (g) ÷ molar mass (g/mol) = number of moles (mol), the molar mass works as the conversion factor between grams and moles. |
Good to know before you start
Here is what helps you use the calculation on this page with real understanding, not just by pressing the button.
| Atoms, molecules and chemical formulas (middle school science) |
|
| Atomic weight and molecular weight (high school chemistry) |
|
| Ratios and percents (Grades 6–7) |
|
| Multiplying and adding decimals (Grades 5–6) |
|
How to calculate it in Excel
| Atomic weight of H | 1.008 |
| Number of H | 2 |
| Atomic weight of O | 15.999 |
| Number of O | 1 |
| Molar mass (g/mol) | =B1*B2+B3*B4 |
| Atomic weight of Al | 26.982 |
| Number of Al | 2 |
| Atomic weight of S | 32.06 |
| Number of S | 3 |
| Atomic weight of O | 15.999 |
| Number of O | 12 |
| Molar mass (g/mol) | =B1*B2+B3*B4+B5*B6 |
| Mass of O (atomic weight × count) | 15.999 |
| Molar mass | 18.015 |
| Mass percent of O (%) | =B1/B2*100 |
"*" is multiplication and "/" is division. The first table calculates "atomic weight of H × count + atomic weight of O × count" with "=B1*B2+B3*B4", and B5 shows 18.015.
For the second table (a formula with parentheses), the trick is to enter the counts after expanding the parentheses (2 of Al, 3 of S and 4 × 3 = 12 of O). B7 shows 342.132.
The third table shows about 88.81 (%) in B3. Just replace the atomic weights and counts with the values for your own formula.
How to calculate it in Google Sheets
| Atomic weight of H | 1.008 |
| Number of H | 2 |
| Atomic weight of O | 15.999 |
| Number of O | 1 |
| Molar mass (g/mol) | =B1*B2+B3*B4 |
| Atomic weight of Al | 26.982 |
| Number of Al | 2 |
| Atomic weight of S | 32.06 |
| Number of S | 3 |
| Atomic weight of O | 15.999 |
| Number of O | 12 |
| Molar mass (g/mol) | =B1*B2+B3*B4+B5*B6 |
| Mass of O (atomic weight × count) | 15.999 |
| Molar mass | 18.015 |
| Mass percent of O (%) | =B1/B2*100 |
How to calculate it in Python
# Atomic weights of the elements you use (IUPAC abridged values; list only the ones you need)
atomic_weight = {"H": 1.008, "C": 12.011, "N": 14.007, "O": 15.999,
"Na": 22.99, "S": 32.06, "Cl": 35.45, "Al": 26.982, "Cu": 63.546}
# Elements and counts in the formula (example: aluminum sulfate Al2(SO4)3 -> 2 Al, 3 S, 12 O)
composition = {"Al": 2, "S": 3, "O": 12}
# Molar mass (molecular weight) = sum of atomic weight x count over all elements
molar_mass = sum(atomic_weight[element] * count for element, count in composition.items())
print(f"Molar mass (molecular weight): {molar_mass} g/mol")
# Mass percent of each element = atomic weight x count / molar mass x 100
for element, count in composition.items():
mass = atomic_weight[element] * count
print(f"{element}: {mass:.3f} g/mol ({mass / molar_mass * 100:.2f}%)")
How to write it in LaTeX and other math languages (copy and paste)
M = Σᵢ (wᵢ × nᵢ)
M = \sum_{i} w_i n_i
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>M</mi>
<mo>=</mo>
<munder><mo>∑</mo><mi>i</mi></munder>
<msub><mi>w</mi><mi>i</mi></msub>
<mo>⁢</mo>
<msub><mi>n</mi><mi>i</mi></msub>
</mrow>
</math>
M = sum_i (w_i n_i)
Sum[w[i]*n[i], {i, 1, k}]
M := add(w[i]*n[i], i = 1 .. k);
M = sum(w .* n);
M = ∑_i (w_i n_i)
P = (wᵢ × nᵢ) ÷ M × 100
P = \dfrac{w_i n_i}{M} \times 100
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>P</mi>
<mo>=</mo>
<mfrac>
<mrow><msub><mi>w</mi><mi>i</mi></msub><mo>⁢</mo><msub><mi>n</mi><mi>i</mi></msub></mrow>
<mi>M</mi>
</mfrac>
<mo>×</mo>
<mn>100</mn>
</mrow>
</math>
P = (w_i n_i)/M xx 100
(w[i]*n[i]/M)*100
P := w[i]*n[i]/M*100;
P = w(i)*n(i)/M*100;
P = (w_i n_i)/M × 100
How to have ChatGPT do the calculation
You are a chemistry calculation assistant. Do the following calculation by actually running Python code, and base your answer only on the numbers from the execution result (do not answer by mental math or guessing). Find the molar mass (molecular weight) of copper(II) sulfate pentahydrate, CuSO4·5H2O. Use the IUPAC abridged atomic weights (Cu = 63.546, S = 32.06, O = 15.999, H = 1.008). Show the following, with the formulas you used and the numbers from the execution result: 1. The breakdown of "atomic weight × count" for each element (Cu, S, O, H) 2. The molar mass (g/mol) 3. The mass percent of each element (%)
How to Use
-
1Enter your numbersType the numbers you want to calculate with into the input fields
-
2CalculatePress the "Calculate" button
-
3Check the resultThe result appears on the spot. The same page also explains the idea behind the calculation and the formula
DataChef Features
No technical knowledge required.
Intuitive and user-friendly operation.
Can be used without registering personal information.
Automatic file deletion by clicking "download".
and rapid file conversion.
No attribution required.
No need to contact us for commercial use permission.
