ThisCalculator

Everyday

Chemical Formula Calculator: How to Use It

Updated · Standard formula, shown below

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 chemical formula calculator works out the empirical or molecular formula of a compound from the masses or percentages of its elements. You enter the element masses (or percent composition) and the molar masses, and it returns the simplest whole-number ratio of atoms, along with the molecular formula if you supply the molar mass of the compound. The result is given as a standard chemical formula like C₆H₁₂O₆.

Formula

The calculator uses the standard method for finding an empirical formula:

  • Convert each element’s mass to moles: moles = mass (g) / atomic mass (g/mol)
  • Divide each mole value by the smallest mole value to get a ratio.
  • If the ratios are not whole numbers, multiply them by the smallest integer that makes them whole (e.g., 1.5 × 2 = 3).
  • For the molecular formula, divide the compound’s molar mass by the empirical formula mass, then multiply each subscript by that integer.

Variables: c, h, o are the masses of carbon, hydrogen, and oxygen in grams; m is the molar mass of the compound in g/mol. The atomic masses used are 12.01 (C), 1.008 (H), and 16.00 (O).

Worked Example

Using the defaults: c = 12.0 g, h = 2.0 g, o = 16.0 g, m = 180.0 g/mol.

  1. Moles of C = 12.0 / 12.01 = 0.999 mol
  2. Moles of H = 2.0 / 1.008 = 1.984 mol
  3. Moles of O = 16.0 / 16.00 = 1.000 mol
  4. Divide by smallest (0.999): C = 1.00, H = 1.99, O = 1.00 → ratio 1:2:1 → empirical formula CH₂O
  5. Empirical formula mass = 12.01 + 2×1.008 + 16.00 = 30.03 g/mol
  6. Multiplier = 180.0 / 30.03 = 5.99 ≈ 6
  7. Molecular formula = (CH₂O)₆ = C₆H₁₂O₆

The calculator returns the molecular formula as C6H12O6, matching the example.

When to Use a Chemical Formula Calculator

You need this tool when you have experimental data from combustion analysis or elemental analysis and want to find the formula of an unknown compound. It is commonly used in:

  • Chemistry homework and lab reports
  • Identifying unknown organic compounds
  • Verifying the formula of a synthesized product
  • Converting between percent composition and formula

The calculator works for any compound, not just those containing C, H, O. You can adapt the inputs to include nitrogen, sulfur, or halogens by adding their masses and atomic masses.

How to Read the Result

The first output is the empirical formula multiplier, which is the smallest whole-number ratio of atoms. The second output is the molecular formula multiplier, which tells you how many empirical units are in the actual molecule. The final output is the molecular formula itself.

For example, if the empirical formula is CH₂O and the multiplier is 6, the molecular formula is C₆H₁₂O₆. If the multiplier is 1, the empirical and molecular formulas are the same.

Common Mistakes and Misconceptions

  • Using percent composition directly without converting to grams: If you have percentages, assume 100 g of compound and treat the percentages as grams.
  • Rounding too early: Round mole ratios only after dividing by the smallest. Rounding intermediate steps can lead to wrong ratios like 1.33 instead of 4/3.
  • Forgetting to multiply by the integer for ratios like 1.5 or 2.5: These are not whole numbers; you must multiply all ratios by 2 (or more) to get whole numbers.
  • Using atomic masses incorrectly: Always use the standard atomic masses from the periodic table (e.g., C = 12.01, H = 1.008, O = 16.00).

Limits of the Formula

This calculator assumes the compound is a pure substance with a known set of elements. It cannot handle mixtures, isotopes, or compounds with unknown elements. It also requires that you know the molar mass of the compound to find the molecular formula; without it, you can only get the empirical formula.

For compounds with more than three elements, you would need to extend the calculation manually. The calculator here is limited to C, H, and O, which covers many organic compounds but not all.

Frequently Asked Questions

What is the difference between empirical and molecular formula?

The empirical formula shows the simplest whole-number ratio of atoms in a compound, while the molecular formula shows the actual number of each atom in a molecule. For example, glucose has the empirical formula CH₂O and the molecular formula C₆H₁₂O₆.

Can I use this calculator for compounds with nitrogen or sulfur?

Not directly, because the calculator only has inputs for carbon, hydrogen, and oxygen. However, you can modify the calculation by adding the masses and atomic masses of other elements manually.

What if my mole ratios are not whole numbers?

If you get ratios like 1.5, 1.33, or 2.5, you need to multiply all ratios by the smallest integer that makes them whole. For example, 1.5:1 becomes 3:2 after multiplying by 2.

Why do I need the molar mass of the compound?

The molar mass is needed to convert the empirical formula to the molecular formula. Without it, you can only determine the simplest ratio, which may not be the actual formula of the molecule.

How do I convert percent composition to grams?

Assume you have 100 g of the compound. Then the percentage of each element becomes its mass in grams. For example, 40% carbon becomes 40 g of carbon.

What are the atomic masses I should use?

Use the standard atomic masses from the periodic table: C = 12.01, H = 1.008, O = 16.00, N = 14.01, S = 32.07, etc. These are the average atomic masses found on most periodic tables.

Related

Formula used
in c | Mass of Carbon (g) | g | 12.0 | 0
in h | Mass of Hydrogen (g) | g | 2.0 | 0
in o | Mass of Oxygen (g) | g | 16.0 | 0
in m | Molar mass of compound (g/mol) | g/mol | 180.0 | 0
out emp | Empirical formula multiplier | - | round(min(c/12.01, h/1.008, o/16.00)) | 0
out mol | Molecular formula multiplier | - | round(m / (c+h+o)) | 0
out formula | Molecular formula | - | "C" + round((c/12.01)*mol) + "H" + round((h/1.008)*mol) + "O" + round((o/16.00)*mol) | 0

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.