Formula Calculator Chemistry: How to Use It
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
A formula calculator for chemistry works out the relative formula mass (Mr) of a compound from its chemical formula and the atomic masses of its elements. You enter the formula and the atomic masses, and it returns the total mass in atomic mass units (u), which is the same number as the molar mass in grams per mole (g/mol).
Formula
The relative formula mass (Mr) is the sum of the atomic masses of every atom in the chemical formula. For a compound with elements A and B, where the formula has x atoms of A and y atoms of B, the equation is:
Mr = (x × atomic mass of A) + (y × atomic mass of B)
For more than two elements, keep adding terms. Each atomic mass is in atomic mass units (u), also called daltons (Da). The numeric value of Mr in u is exactly the same as the molar mass in grams per mole (g/mol) when using the same atomic masses. This is because one mole of a substance contains Avogadro’s number of particles (6.022 × 10^23), and the mass of one particle in u equals the mass of one mole in grams.
Worked Example
Using the default values from the calculator, water (H2O) with atomic masses H = 1.008 u and O = 16.00 u:
- Identify the atoms: 2 hydrogen atoms and 1 oxygen atom.
- Multiply each atomic mass by its count: 2 × 1.008 = 2.016 u for hydrogen.
- Add the oxygen mass: 2.016 + 16.00 = 18.016 u.
- Round to two decimal places: 18.02 u.
The calculator gives 18.02 u for the relative formula mass and 18.02 g/mol for the molar mass. This matches the known value for water, which is why the default is realistic.
What This Number Is Used For
The relative formula mass is the bridge between the microscopic world of atoms and the macroscopic world of laboratory measurements. It lets you convert between mass and moles, which is essential for:
- Stoichiometry: Balancing chemical equations and calculating how much product a reaction will produce.
- Solution concentration: Preparing a solution of a given molarity (moles per litre) requires knowing the molar mass to weigh out the correct amount.
- Empirical and molecular formulas: Comparing the experimental mass of a compound to its empirical formula mass reveals the molecular formula.
- Gas density and effusion: Graham’s law and the ideal gas law use molar mass to predict how gases behave.
Without the molar mass, you cannot calculate moles, and without moles, you cannot do quantitative chemistry.
How to Read the Result
The result is a dimensionless number when written as relative formula mass, but it carries two different units depending on context. In a mass spectrometer, you read it as atomic mass units (u). In a chemistry lab, you read the same number as grams per mole (g/mol). For example, carbon dioxide (CO2) has Mr = 44.01 u, so one mole of CO2 weighs 44.01 grams.
This equivalence is not a coincidence; it is the definition of the mole. The Avogadro constant is chosen so that the mass of one mole in grams equals the average mass of one particle in u. Therefore, the calculator’s molar mass output is exactly the number you would use on a balance.
Be careful with hydrated salts. For a compound like copper(II) sulfate pentahydrate (CuSO4·5H2O), the formula mass must include the water molecules. The dot means the water is part of the crystal structure, so you add 5 × 18.02 = 90.10 u to the anhydrous salt’s mass. Omitting the water is a common error that leads to incorrect concentrations.
Common Mistakes and Unit Mix-Ups
The most frequent error is using the wrong atomic mass. Atomic masses are weighted averages of an element’s naturally occurring isotopes, so they are not whole numbers. Using a rounded value like 1 for hydrogen instead of 1.008 changes the result slightly but can matter in precise work. For most school calculations, using values rounded to two decimal places is acceptable, but for analytical chemistry, use the full periodic table values.
Another mistake is misreading the formula. Subscripts apply only to the element they follow. For example, in H2SO4, there are 2 hydrogen atoms, 1 sulfur atom, and 4 oxygen atoms. Parentheses multiply everything inside them: in Ca(OH)2, there are 2 oxygen and 2 hydrogen atoms. The calculator does not parse formulas, so you must count atoms yourself and enter the correct multipliers in the expression.
Unit confusion also arises when converting between grams and moles. The molar mass is grams per mole, not grams. To find moles, divide the mass in grams by the molar mass. To find mass, multiply moles by molar mass. If you mix these up, your answer will be off by a factor of the molar mass, which is usually dozens of grams.
Limits of the Formula
This simple sum works for any neutral molecule or ionic compound, but it has limits. It does not account for isotopes. If you need the exact mass of a specific isotope (for mass spectrometry), you must use that isotope’s exact mass, not the average atomic mass. For example, carbon-12 has an exact mass of 12.000 u, while the average atomic mass of carbon is 12.011 u.
The calculator also does not handle isotopes, charges, or structural isomers. Two different compounds with the same formula (isomers) have the same formula mass, even though their properties differ. The formula mass is independent of how the atoms are arranged, so it cannot distinguish between ethanol (C2H6O) and dimethyl ether (C2H6O), both of which have Mr = 46.07 u.
For polymers or large biomolecules, the formula mass is an average over many chains of different lengths. The concept still applies, but the value is a distribution rather than a single number. In such cases, mass spectrometry reports an average or a most abundant mass.
How to Choose Atomic Masses
Choose atomic masses from a reliable periodic table. The IUPAC (International Union of Pure and Applied Chemistry) publishes standard atomic weights that are updated periodically. For most educational purposes, the values on a standard periodic table (like H = 1.008, C = 12.011, N = 14.007, O = 15.999) are sufficient. If you are doing precise work, use the most recent IUPAC values, which may have a range for elements with variable isotopic abundance (e.g., sulfur is given as 32.059 to 32.076).
For a quick estimate, you can round each atomic mass to the nearest whole number (H = 1, C = 12, O = 16). This is fine for rough calculations and for checking whether an answer is plausible. However, for titration calculations or preparing solutions where accuracy matters, use at least two decimal places.
Frequently Asked Questions
What is the difference between relative formula mass and relative molecular mass?
Relative molecular mass (Mr) is used for molecules with covalent bonds, like water or glucose. Relative formula mass is a broader term that also covers ionic compounds like sodium chloride (NaCl), which do not exist as discrete molecules. In practice, the calculation is identical: sum the atomic masses of all atoms in the formula. The term “formula mass” is preferred for ionic compounds, but many textbooks use them interchangeably.
Why is the molar mass in g/mol numerically equal to the formula mass in u?
This is by definition. The mole is defined as the amount of substance containing as many entities as there are atoms in 0.012 kilograms of carbon-12. That number is Avogadro’s constant, approximately 6.022 × 10^23. Because of this choice, the mass of one mole of a substance in grams is numerically equal to the average mass of one particle in atomic mass units. It is not a coincidence; it is the foundation of the mole concept.
Can I use this calculator for a compound with more than two elements?
Yes, but you need to add more terms to the expression. For example, for sulfuric acid (H2SO4), the expression would be (2 * h) + s + (4 * o), where you would add an input for the atomic mass of sulfur. The calculator in this article only has two element inputs for simplicity, but you can extend the formula manually or use a more complete tool. The principle is always the same: multiply each atomic mass by its subscript and add them all.
What if the formula has parentheses, like Ca(OH)2?
You must expand the parentheses yourself. The subscript outside the parentheses multiplies every atom inside. So Ca(OH)2 has 1 calcium, 2 oxygen, and 2 hydrogen atoms. In the calculator, you would set the expression to ca + (2 * o) + (2 * h), where ca, o, and h are the atomic masses. The calculator does not parse the formula, so manual expansion is required.
Does the formula mass change with temperature or pressure?
No. The formula mass is a property of the substance itself, independent of physical conditions. Temperature and pressure affect the state of matter (solid, liquid, gas) and the volume, but not the mass of the individual particles. The molar mass also remains constant; it is the mass per mole, which does not change with temperature or pressure. This is why molar mass is a reliable conversion factor in gas law calculations.
Why do some periodic tables list atomic masses with a range, like for sulfur?
Some elements have multiple stable isotopes whose relative abundance varies slightly depending on the source (e.g., sulfur from different geological deposits). The IUPAC now gives a standard atomic weight as an interval to reflect this natural variation. For most calculations, you can use a single representative value from the middle of the range, such as 32.06 for sulfur. The difference is tiny and rarely affects stoichiometric calculations.
Related
Formula used
in f | Formula (e.g. H2O) | - | H2O | 0 in h | Atomic mass of H | u | 1.008 | 0 in o | Atomic mass of O | u | 16.00 | 0 out mr | Relative formula mass | u | (2 * h) + o | 2 out mm | Molar mass | g/mol | (2 * h) + o | 2
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.