What is the Molecular Weight Calculator?
This tool computes the molecular weight (also called formula weight or molar mass) of a chemical compound directly from its molecular formula. Enter a formula such as H2O, AgS2O3, or Na3AsO16H24 and it returns the total mass in grams per mole (g/mol), along with a breakdown showing each element's atomic number, name, standard atomic weight, atom count, and contribution to the total.
How to use it
Type a formula as a flat list of element symbols with optional counts. Each symbol is one uppercase letter optionally followed by one lowercase letter (the IUPAC atomic symbol), optionally followed by an integer count. Omitting the count means one atom, so CO2 is one carbon and two oxygens. Case matters: CO means carbon plus oxygen, while Co means cobalt. This baseline version does not support parentheses, brackets, or hydrate dot notation (for example Ca(OH)2 or CuSO4·5H2O must be expanded manually).
The formula explained
The calculator parses the string with the pattern ([A-Z][a-z]?)(\d*), looks up each element's standard atomic weight from a periodic table covering elements 1 to 118, multiplies that weight by the atom count, and sums every contribution: $$\text{MW} = \sum_{i} n_i \cdot A_i \quad \text{from } \text{Molecular Formula}$$ Atomic weights are already in g/mol (equivalently unified atomic mass units per molecule), so no unit conversion is needed.
Worked example
For silver thiosulfate AgS2O3: Ag \(= 1 \times 107.8682 = 107.8682\); S \(= 2 \times 32.065 = 64.130\); O \(= 3 \times 15.9994 = 47.9982\). Total $$= 107.8682 + 64.130 + 47.9982 = 219.9964 \text{ g/mol}.$$ For water H2O: $$2 \times 1.00794 + 15.9994 = 18.01528 \text{ g/mol}.$$
FAQ
What units is the result in? Grams per mole (g/mol), the standard unit for molar mass.
Can I enter parentheses or hydrates? Not in this version. Expand groups by hand, e.g. write Ca(OH)2 as CaO2H2.
Why does my formula show an error? Likely an unrecognized symbol, a lowercase-led token, or stray characters. Symbols must be exactly uppercase plus an optional lowercase letter from the periodic table.