Chemical Formula Calculator
Find the molar mass and elemental composition of any chemical formula.
Enter formulas like H2O, C6H12O6, or Ca(OH)2 and get mass and percent composition.
The molar mass of a compound is the mass in grams of one mole (6.022 x 10^23 formula units). It equals the sum of the atomic masses of all atoms in the formula, weighted by how many of each appear.
For water (H2O): two hydrogens (1.008 each) plus one oxygen (15.999) = 18.015 g/mol. For glucose (C6H12O6): 6(12.011) + 12(1.008) + 6(15.999) = 72.066 + 12.096 + 95.994 = 180.156 g/mol.
This calculator parses standard chemical notation including parentheses and subscripts. Ca(OH)2 is correctly read as Ca + 2*(O + H) = Ca + 2O + 2H. Al2(SO4)3 expands to 2Al + 3S + 12O.
The percent composition by mass for each element = (element contribution / molar mass) x 100. For water: H is 2(1.008)/18.015 = 11.19%, O is 15.999/18.015 = 88.81%.
Atomic masses used are the 2021 IUPAC standard values, rounded to 3 decimal places for most elements. Radioactive elements without a stable isotope use the mass of the most stable known isotope.
Molar mass is used constantly in stoichiometry: converting between grams and moles, calculating theoretical yields, preparing solutions of known concentration, and checking whether an empirical formula matches a molecular formula. If two compounds have the same empirical formula (like CH2O for glucose and formaldehyde), their molar masses immediately show they are different molecules.
Enter any valid formula. Nested parentheses are supported. Capitalization matters — Ca is calcium, ca is not recognized.
How we build and check this calculator
This calculator runs entirely in your browser, so the numbers you enter stay on your device. The math behind it is written by hand and tested against worked examples and standard references before the page goes live.
SuperGlobalCalculator is independently built and maintained. See how we build and verify our calculators.