Chemistry Calculator

How many moles are in your compound, and at what concentration?

Enter a chemical formula, mass, and volume to calculate moles, molar mass, and molarity. Covers the core stoichiometry calculations used in every general chemistry lab.

Updated July 2026 · How this works

Example calculation — edit any field to use your own numbers

Worth knowing
How It Works
The formula, explained simply

Think of a mole the way you think of a dozen. A dozen eggs is always 12 eggs regardless of how big they are. A mole of any substance is always 6.022 times 10 to the 23rd formula units, regardless of what the compound is. The mole concept exists because atoms are too small to count individually, but you can weigh a pile of them on a balance scale.

This calculator reads your chemical formula character by character, looks up the standard atomic weight of each element, multiplies by the subscript count, and sums across all elements. That sum is the molar mass in grams per mole. Dividing your measured mass by that molar mass gives moles — the number that connects your bench measurement to the quantities in a chemical equation.

Molarity adds one more step: dividing moles by the volume of solution in liters. The result tells you how many moles are packed into every liter of your solution. A 1 M solution of glucose contains 180 grams of glucose dissolved in enough water to make exactly one liter of solution. This is the standard unit chemists use when writing reaction protocols, because reactions care about how many molecules are present per unit volume, not just how much mass you started with.

When To Use This
Right tool, right situation

Use this calculator whenever you are preparing a solution from a solid reagent and need to hit a target concentration, or when you have a known mass and need to know how many moles of reaction it represents. It covers the majority of stoichiometry problems in introductory and intermediate chemistry: buffer preparation, titration setup, reagent limiting calculations, and dilution checks.

It is also useful when you have a literature protocol specifying a molar concentration and you need to convert that to a weigh-out mass for your specific batch size. Enter the formula, calculate molar mass, then use n = C times V to find moles, then m = n times M to find the mass — or rearrange directly as m = C times V times M. The calculator handles the first two of those steps directly.

This tool is not appropriate for gas-phase stoichiometry where ideal gas law (PV = nRT) governs quantity, for reactions in non-aqueous solvents where concentration definitions differ from aqueous molarity, or for any compound where the formula you enter is not the actual dissolved species. Strong acids and bases dissociate in water — HCl dissolved in water has a proton activity, not a 1 M molecular concentration. For those cases, molarity of the parent compound is still the correct preparation concentration, but the solution chemistry is more complex than this tool represents.

Common Mistakes
Why results sometimes look wrong

Mistake: entering the solvent volume instead of the final solution volume. This happens when someone adds a fixed volume of water to their compound rather than diluting to a target volume. If you add 500 mL of water to a compound, the final solution volume is slightly more than 500 mL. The correct input is the total final volume you fill to — typically the capacity marked on a volumetric flask. Using the water volume added underestimates the final volume and overestimates the molarity.

Mistake: using mass in milligrams when the field expects grams. Entering 250 when you mean 250 mg produces a mole count 1,000 times too high. All standard molar mass tables give g/mol, so mass must be in grams. If you are working at the milligram scale, divide by 1,000 before entering: 250 mg becomes 0.250 g. The resulting molarity will then reflect the correct concentration in M, which you can multiply by 1,000 if you need millimolar.

Mistake: treating molar mass as the same as molecular weight in daltons. They are numerically equal but the units differ — g/mol versus daltons (Da or u). This matters when cross-referencing a result against a mass spectrometry reading or a biochemistry data sheet. A protein listed at 50,000 Da has a molar mass of 50,000 g/mol, so one micromole weighs 0.05 g. Confusing the units by a factor of 1,000 is a common error when scaling between biochemistry (which uses kDa) and preparative chemistry (which uses g/mol).

The Math
Worked examples and deeper derivation

The molar mass calculation sums atomic weights across the molecular formula: M = sum of (atomic weight of element i times count of element i). For NaCl that is 22.990 plus 35.453 equals 58.443 g/mol. For a compound like Ca(OH)2 the parser first resolves the parenthetical group OH to 15.999 plus 1.008 equals 17.007, multiplies by 2 to get 34.014, then adds Ca at 40.078 to get 74.092 g/mol.

Moles is simply n = m divided by M, where m is mass in grams and M is molar mass in g/mol. Molarity is C = n divided by V, where V is volume in liters. Rearranging: m = C times V times M. That rearrangement is what you use when working backwards — if you want a specific molarity at a specific volume, multiply those three numbers to get the mass to weigh out.

The mass needed to make 1 liter of a 1 M solution is numerically equal to the molar mass. This output is displayed as a practical shortcut. To make 500 mL of 2 M NaCl, you would need 0.5 times 2 times 58.44 equals 58.44 g — the same number, coincidentally, because volume times molarity equals 1. For 250 mL of 0.1 M glucose, the calculation is 0.25 times 0.1 times 180.16 equals 4.504 g.

Making a 0.2 M NaCl buffer for a cell culture experiment
Formula: NaCl, Mass: 11.69 g, Volume: 1.000 L
The calculator returns 0.2 mol and 0.2 M. This confirms the weighed amount will hit exactly the target concentration when dissolved in 1 liter. The molar mass output of 58.44 g/mol serves as a cross-check against the reagent bottle.
Edge case: very small mass for a high-molecular-weight compound
Formula: C12H22O11 (sucrose), Mass: 0.342 g, Volume: 0.001 L
Result is 0.001 mol and 1.0 M. Even at milligram scale and milliliter volumes, the calculation holds. This is useful for making stock solutions when reagent supply is limited or when working with expensive compounds.
Pharmacist checking a compounding formula
Formula: C8H9NO2 (acetaminophen), Mass: 15.12 g, Volume: 0.100 L
Molar mass is 151.16 g/mol, giving 0.1 mol dissolved in 100 mL — a 1 M solution. A pharmacist can use this to verify that a compounded suspension contains the expected molar quantity before adjusting for dosing volume.
Expert Unlock
The thing most explanations skip

The atomic weights used here are the 2021 IUPAC standard atomic weights, which are themselves weighted averages over natural isotopic abundances. For compounds containing boron, lithium, or uranium — elements whose isotopic composition varies measurably by geographic source — the molar mass from a standard table may differ from the actual molar mass of your specific reagent batch by several tenths of a percent. High-precision gravimetric work uses the isotopic composition certified on the reagent bottle rather than the tabulated standard weight. Also: this parser handles one level of nested parentheses correctly but does not resolve complex coordination compound notation like [Fe(CN)6]4-. For those, sum the components manually.

What does the moles result actually tell you?

How do I calculate moles from grams?
Divide the mass in grams by the molar mass of the compound. Molar mass is the sum of atomic weights of every atom in the formula — for NaCl that is 22.99 plus 35.45 equals 58.44 g/mol. So 5.85 g divided by 58.44 g/mol gives 0.1 mol exactly. This calculator performs the atomic weight summation automatically from the formula you type.
What is molarity and how is it different from moles?
Moles is a count of how many formula units of a compound you have. Molarity is how concentrated a solution is — it is moles divided by liters of solution. You can have 0.1 mol of NaCl as a powder in a bag, or dissolved in 0.1 L to make a 1 M solution, or dissolved in 1 L to make a 0.1 M solution. The mole count stays the same; molarity changes with volume.
Why does my formula not parse correctly?
The most common cause is using lowercase letters for the first character of an element symbol — write Na not na, and Cl not cl. Parentheses for polyatomic groups like Ca(OH)2 are supported. Hydrates written with a dot like CuSO4.5H2O are not supported — enter the anhydrous formula and account for water separately. Isotope notation and formal charges are also not supported.

Need something this doesn't cover?

Suggest a tool — we'll build it →