molecalculator

Moles & Molar Mass

Molecular Weight Calculator From a Chemical Formula

Calculator No. 01-4604 · Updated · Formula and assumptions shown below

Molecular weight of H2O 18.015 g/mol
Number of hydrogen atoms
2 atoms
Set in the form below
Number of oxygen atoms
1 atoms
Set in the form below
You enter
Number of hydrogen atoms (atoms), Number of oxygen atoms (atoms)
You get
Molecular weight of H2O (g/mol)
Rounding
3 dp

For study and lab planning. The result follows from the numbers you enter and the formula shown. Check it against your method before you weigh, mix or dilute anything, follow the safety data sheet and your supervisor, and do not use it for clinical, dosing or medication work.

A molecular weight (also called molar mass) calculator from a chemical formula adds the atomic masses of every atom shown in the formula and returns the result in g/mol. Enter a formula such as H2O or C6H12O6, plus the amount of each element if your calculator represents formulas with separate fields; the calculation below shows the standard formula and a worked example for water.

Formula

Molecular weight is the sum of each element’s atomic weight multiplied by the number of its atoms in the formula: M = Σ(ni × Ai). Here, M is the molar mass in g/mol, ni is the number of atoms of element i in one molecule or formula unit, and Ai is that element’s standard atomic weight in g/mol. The calculator block illustrates the formula for water: M(H2O) = 2 × 1.008 + 1 × 15.999. The atomic weights used here are H = 1.008 and O = 15.999.

Worked Example

For water, H2O, the formula contains two hydrogen atoms and one oxygen atom. Using the exact default inputs above:

  1. Hydrogen contribution: 2 × 1.008 = 2.016 g/mol.
  2. Oxygen contribution: 1 × 15.999 = 15.999 g/mol.
  3. Total: 2.016 + 15.999 = 18.015 g/mol.

The calculator displays 18.015 g/mol. This is the molar mass of water under the stated atomic-weight convention.

Assumptions

  • The formula represents one neutral molecule or formula unit, and the atom counts entered are nonnegative whole numbers.
  • The result uses the listed abridged standard atomic weights. Isotopically enriched or specifically isotope-labelled material can have a different molar mass.
  • The output is a molar mass in g/mol, numerically equivalent to molecular mass in unified atomic mass units (u) for a single molecule.

How to Read and Use the Result

“Molecular weight” is commonly used for a molecule’s relative mass, a dimensionless ratio, while “molar mass” is the mass of one mole and has units such as g/mol. In everyday chemistry and calculator searches, the terms are often used interchangeably. This page reports g/mol, so it gives the quantity useful for converting between a sample’s mass and amount of substance.

For example, if a pure water sample has a mass of 18.015 g, dividing by 18.015 g/mol gives 1 mol. More generally, amount in moles is sample mass in grams divided by molar mass in g/mol. That conversion assumes you know the sample’s actual composition and that the mass refers to the compound, not a mixture or solution.

A formula-based calculator is useful for checking a compound’s molar mass before doing stoichiometry, preparing a worksheet, or converting between grams and moles. It does not determine the formula from a name or identify an unknown substance. If you only know a compound name, first verify its chemical formula from a reliable reference; names can refer to different forms, hydrates, salts, or isomers.

Entering Formulas Correctly

The calculator block is a compact example using separate atom-count inputs. A general formula parser should accept element symbols with correct capitalization and subscripts written as ordinary digits: H2O, CO2, or C6H12O6. Each element’s contribution is its atomic weight times its count. An element appearing once has an implicit count of 1, even when the “1” is not printed.

Parentheses multiply the counts inside them. For example, Ca(OH)2 contains one Ca, two O, and two H atoms: the outside subscript 2 applies to both O and H. A hydrate dot indicates additional formula units of water of crystallization; for instance, a formula written with a dot and a leading coefficient requires multiplying all atoms in that water unit by the coefficient, then adding them to the rest of the formula. Check that a calculator supports parentheses and hydrate notation before relying on direct text entry.

Ionic compounds are calculated from the smallest neutral formula unit, not a discrete molecule when no separate molecules exist. For example, NaCl represents a 1:1 formula unit. The same sum of atomic weights applies, but “formula mass” may be the more precise term for an ionic solid.

Common Errors and Limits

  • Incorrect capitalization: Co means cobalt, while CO means carbon and oxygen. A lowercase letter is part of an element symbol, not a new element.
  • Misreading subscripts: In C6H12O6, the 6, 12, and 6 are atom counts. A coefficient in front of a formula multiplies the entire formula rather than changing its intrinsic molar mass.
  • Leaving out brackets or hydration: Omitting parentheses or water of crystallization changes the atom totals and therefore the answer.
  • Mixing units: Atomic weights are expressed on a scale that gives molar masses in g/mol. Do not add a value in kg/mol to one in g/mol without converting units.
  • Assuming every sample is pure: A calculated formula mass is not a purity measurement. Impurities, solvent, moisture, and mixtures affect the mass-to-moles conversion for a real sample.

Atomic weights are conventional values based on naturally occurring isotopic compositions; the values for some elements can vary slightly with the source and sample. The calculator’s output may therefore differ by a small amount from a reference that uses a different atomic-weight table or more digits. For a compound containing a specified isotope, use that isotope’s mass and its actual abundance rather than an average standard atomic weight.

The calculation also does not account for temperature, pressure, crystal structure, or chemical reactions. Those conditions do not change the formula’s basic sum of atomic weights, but they may matter when interpreting a real sample or measuring its quantity. For bench work, follow your lab method, the safety data sheet (SDS) and your supervisor.

Frequently Asked Questions

How do I calculate molecular weight from a formula?
Count each element’s atoms, multiply each count by its atomic weight, and add the contributions. For H2O, that is 2 × 1.008 + 15.999 = 18.015 g/mol.

Is molecular weight the same as molar mass?
They are often used interchangeably in practical chemistry. Strictly, molecular weight is a relative, dimensionless mass; molar mass is mass per mole and has units such as g/mol.

Do I include the charge on an ion?
A charge does not add or remove a meaningful amount of atomic mass for ordinary molar-mass calculations. Use the atoms in the ion’s formula; if calculating a compound, use its complete neutral formula unit.

How are parentheses handled in a chemical formula?
Multiply every atom count inside parentheses by the subscript outside them. In Ca(OH)2, there are two oxygen atoms and two hydrogen atoms, as well as one calcium atom.

Why might two calculators give slightly different answers?
They may use different atomic-weight precision or conventions, handle isotope abundance differently, or interpret a hydrate or salt form differently. Confirm the formula and the atomic-weight values used.

Related

Formula used
in n | Number of hydrogen atoms | atoms | 2 | 0
in o | Number of oxygen atoms | atoms | 1 | 0
out mw | Molecular weight of H2O | g/mol | n * 1.008 + o * 15.999 | 3

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 with the constants and conversion factors written on the page, rounded as each result states. See method and constants, the disclaimer or report an error.

More in this section

The whole Moles & Molar Mass section →