molecalculator

Moles & Molar Mass

Chemical Formula Writing: Rules, Examples & Calculator

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

Molar mass contribution 24.022 g/mol
Atom count
2
Set in the form below
Atomic weight
12.011 g/mol
Set in the form below
You enter
Atom count, Atomic weight (g/mol)
You get
Molar mass contribution (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.

Chemical formula writing is the way chemists use element symbols and numbers to show which atoms or ions make up a substance and, in many cases, their proportions. This calculator adds up a formula’s molar mass from the elements and atom counts you enter, returning a result in grams per mole (g/mol).

Formula

The calculator uses molar-mass contribution = atom count × atomic weight, or m = n × A. Here, n is the number of atoms represented by the element in the formula, in atoms; A is its relative atomic weight, expressed numerically in g/mol; and m is that element’s contribution to the formula’s molar mass, in g/mol. Enter one element at a time and add the contributions to get the compound’s total molar mass. For example, in CO2, calculate carbon’s contribution and oxygen’s contribution separately, then add them.

The atomic weights are inputs because they depend on the element and, for some elements, the accepted standard value may be reported as an interval. Common abridged values include H 1.008, C 12.011, N 14.007, O 15.999, Na 22.990, Cl 35.45, and S 32.06 g/mol. Use the appropriate value for each element in the formula.

Worked Example

With the default inputs, the calculator finds the contribution of two carbon atoms:

m = n × A = 2 atoms × 12.011 g/mol = 24.022 g/mol

The displayed result, rounded to three decimal places, is 24.022 g/mol. This is only the carbon contribution, not the molar mass of a complete compound unless the formula contains only those two carbon atoms. For a full formula, repeat the calculation for every element and sum the contributions.

Assumptions

  • The atom count is a nonnegative whole-number count from a chemical formula; this calculator accepts numeric entries, so enter whole numbers.
  • Atomic weights are supplied by the user and are in g/mol.
  • The result is a formula-based molar mass, not a measured sample mass or a purity correction.
  • For ionic compounds, the formula represents the simplest charge-balanced ratio of ions, not a discrete molecule.

How Chemical Formulas Work

A chemical formula uses element symbols to identify the elements present. A subscript after a symbol gives the number of atoms of that element in one formula unit. If there is no subscript, the count is one. Thus H2O contains two hydrogen atoms and one oxygen atom; CO2 contains one carbon and two oxygen atoms. The subscript applies only to the symbol immediately before it, unless parentheses group a larger unit.

Parentheses and brackets help express repeated groups. In Ca(OH)2, the subscript 2 multiplies both atoms inside the parentheses: the formula has one calcium, two oxygen, and two hydrogen atoms. In Al2(SO4)3, the sulfate group occurs three times, giving two aluminum, three sulfur, and twelve oxygen atoms. Expanding these counts before calculating molar mass helps prevent missed atoms.

A coefficient placed before a formula applies to the whole formula in a chemical equation. For example, 2H2O means two water molecules or formula units, for a total of four hydrogen atoms and two oxygen atoms. The coefficient is not part of water’s chemical formula and does not change the molar mass of one mole of water; it changes the amount represented in the equation.

Choosing the Right Kind of Formula

Not every formula tells the same kind of structural story. A molecular formula gives the actual number of each type of atom in a molecule, while an empirical formula gives the simplest whole-number ratio. Glucose has molecular formula C6H12O6 and empirical formula CH2O. The two formulas describe different information, although their atom ratios match.

Ionic solids are commonly written as formula units showing the smallest whole-number ratio that balances charge. Sodium chloride is NaCl: one Na+ for each Cl−. It is misleading to imagine that each NaCl unit is a separate molecule in the solid. For a hydrate, a centered dot separates the ionic compound from water molecules included in the crystal formula; the water count is included in molar-mass calculations.

  • Use a molecular formula when the substance consists of identifiable molecules and the molecular composition is known.
  • Use an empirical formula when only the simplest atom ratio is known or requested.
  • Use an ionic formula unit for a charge-balanced ionic compound.
  • Preserve parentheses, hydrate water, and stated charge information when interpreting a formula.

Writing and Checking a Formula

For an ionic compound, identify the ions and their charges, then choose the smallest ratio that makes the total charge zero. Magnesium is Mg2+ and chloride is Cl−, so one magnesium ion pairs with two chloride ions: MgCl2. The subscripts are written as the simplest whole-number ratio; a subscript of one is omitted. When a polyatomic ion appears more than once, enclose it in parentheses, as in Al(OH)3.

For molecular compounds, the formula is based on composition or molecular structure rather than balancing ionic charges. Prefixes in a compound name can indicate atom counts, but naming conventions vary with the type of compound. Do not use the charge-crossing shortcut indiscriminately: it can produce a reasonable ionic ratio, but the result must be reduced to lowest terms and checked for neutrality.

A useful final check is to count each element independently, expand grouped units, and verify charge balance where ions are involved. In a reaction equation, also check that each element has the same atom count on both sides; balancing changes equation coefficients, not the subscripts inside a substance’s formula.

Common Mistakes and Limits

  • Changing subscripts while balancing: Doing so changes the substance. Balance a reaction with coefficients instead.
  • Forgetting a group multiplier: In (NO3)2, there are two nitrogen atoms and six oxygen atoms.
  • Confusing a coefficient and a subscript: 3CO2 represents three units of carbon dioxide, not a new compound with formula C3O2.
  • Mixing formula types: An empirical formula does not necessarily state the number of atoms in a molecule; a molecular formula does.
  • Rounding too early: Keep adequate precision for each atomic-weight contribution and round the final sum to a sensible number of decimal places.

The calculator deliberately handles one element’s contribution at a time; it does not parse parentheses, determine a formula from a name, infer ionic charges, or decide whether a formula is chemically correct. For a compound, count the atoms correctly first, enter each element’s count and atomic weight, and sum the outputs. The result is a calculated molar mass based on the atomic weights supplied, so isotope composition, sample impurities, and measurement uncertainty are outside its scope.

Frequently Asked Questions

What does a chemical formula tell you?
A formula identifies the elements in a substance and shows their relative or actual counts, depending on whether it is empirical, molecular, or an ionic formula unit.

What does a subscript mean in a chemical formula?
A subscript gives the count of the element or grouped unit immediately before it. A missing subscript means one.

How do you calculate molar mass from a formula?
Count each element’s atoms, multiply each count by that element’s atomic weight in g/mol, and add the contributions.

Why is the one in H2O not written?
Chemical notation omits a subscript of one. H2O therefore means two hydrogen atoms and one oxygen atom.

Can you change a formula’s subscripts to balance an equation?
No. Subscripts define the substance’s composition. Adjust coefficients in front of formulas to balance a reaction.

Is NaCl a molecule?
Solid sodium chloride is an ionic lattice, so NaCl indicates the simplest ratio of sodium to chloride ions rather than a separate NaCl molecule.

Related

Formula used
in n | Atom count | - | 2 | 0
in aw | Atomic weight | g/mol | 12.011 | 0
out mm | Molar mass contribution | g/mol | n * aw | 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 →