Skip to content
Chemistry

Molar Mass Calculator

Type a chemical formula and get its molar mass in grams per mole instantly. The calculator sums standard IUPAC atomic weights, shows a full per-element breakdown, converts between grams and moles in either direction, counts molecules using Avogadro's number, and optionally derives molar mass from ideal-gas P, V, T, m data.

Your details

Use element symbols with subscripts. Parentheses and brackets are supported, plus hydrate dot notation with * or a period, e.g. CuSO4*5H2O.
g/mol is the standard chemistry unit. kg/mol is useful for larger molecules. Da and u are numerically equal to g/mol for conventional atomic weights.
Choose what additional quantity to compute alongside the molar mass.
Mass in grams. The calculator converts this to moles using n = m / M.
g
Turn this on to find the molar mass of an unknown gas from its pressure, volume, temperature, and mass, using the ideal gas law M = mRT / PV.
Molar mass
180.156 g/mol
Molar mass (g/mol)180.156
Molar mass (kg/mol)0.180156
Atoms per formula unit24
Moles0.09991mol

C6H12O6 has a molar mass of 180.156 g/mol.

  • C6H12O6 contains 24 atoms per formula unit, summed from standard IUPAC atomic weights.
  • One mole of this substance (6.022 x 10^23 formula units) weighs exactly this many grams.
  • The composition table below shows each element's percent contribution to the total mass.
  • Your 18 g sample contains 0.09991 mol of C6H12O6.

Next stepDissolving this in a known volume? Use the molarity calculator to find the concentration in mol/L.

Element composition breakdown

ElementAtomic weight (g/mol)CountSubtotal (g/mol)% by mass
O15.999695.99453.28 %
C12.011672.06640 %
H1.0081212.0966.71 %

Atomic weights are standard IUPAC 2021 conventional values. Percent by mass = element subtotal / total molar mass x 100.

Formula

M=iaiAin=mMm=nMN=nNAM=mRTPVM = \sum_{i} a_i \, A_i \quad n = \dfrac{m}{M} \quad m = nM \quad N = n N_A \quad M = \dfrac{mRT}{PV}

Worked example

Glucose (C6H12O6): M = 6 x 12.011 + 12 x 1.008 + 6 x 15.999 = 72.066 + 12.096 + 95.994 = 180.156 g/mol. For 36 g of glucose: n = 36 / 180.156 = 0.1998 mol, N = 0.1998 x 6.022 x 10^23 = 1.203 x 10^23 molecules. Ideal gas example: 2 g of unknown gas at 1 atm, 273.15 K, 1 L gives n = (1 x 1)/(0.08206 x 273.15) = 0.04462 mol, M = 2 / 0.04462 = 44.8 g/mol (close to CO2 at 44.01 g/mol).

How molar mass is computed from a formula

Molar mass (M) is the mass of one mole of a substance in grams per mole (g/mol). For any compound it is the sum, over every atom in the chemical formula, of that element's standard atomic weight multiplied by how many times it appears: M = sum of a_i times A_i, where a_i is the atom count and A_i is the IUPAC atomic weight. This calculator parses the formula you type, expands any parentheses, brackets, and hydrate dot notation into element counts, then adds up each contribution. The output is also available in kg/mol, Daltons (Da), or atomic mass units (u), all numerically consistent with the g/mol value. Because the atomic weights used are the 2021 IUPAC conventional values, results match a careful hand calculation from a standard periodic table.

Grams-to-moles, moles-to-grams, and molecule counting

Switch the conversion mode selector to go beyond molar mass. Grams to moles (n = m / M) is the most common lab conversion: enter a sample mass and read off the amount of substance. Moles to grams (m = n x M) is the reverse, useful for weighing out a specific amount. Both moles to molecules and grams to molecules apply Avogadro's number (NA = 6.02214076 x 10^23 mol^-1), the exact value fixed by the 2019 SI redefinition, to count individual molecules or formula units in a sample. All four conversions are live, meaning the result updates as you change the formula or the quantity.

Ideal-gas molar mass from P, V, T, and m

Enable the ideal-gas panel to identify an unknown gas from experimental data. The ideal gas law PV = nRT can be rearranged to M = mRT / PV, where m is the mass of gas in grams, R is the gas constant (0.082057 L·atm/(mol·K)), T is temperature in Kelvin, P is pressure in atm, and V is volume in litres. Enter values in any of the supported units (atm, kPa, bar, or mmHg for pressure; L, mL, or m3 for volume; K, Celsius, or Fahrenheit for temperature) and the calculator converts internally before applying the formula. This method is accurate for light gases at low pressure and temperature near ambient; real gases deviate from ideal behaviour at high pressures.

Reading the per-element breakdown

Below the result you get a composition table listing each element, its IUPAC atomic weight, the number of atoms per formula unit, the subtotal it contributes in g/mol, and its percent by mass. Percent by mass is the element subtotal divided by the total molar mass times 100, and the percentages always add to 100. This breakdown is what you need for empirical-formula problems, fertiliser nutrient ratios, and purity checks. The table is sorted by the largest contributor first so the dominant elements are easy to spot.

Formula syntax the parser accepts

Start every element with a capital letter and add a lower-case second letter where it has one, so sodium is Na and chlorine is Cl. Put the count as a subscript directly after the symbol, for example O2 or C6. Group repeated units in parentheses or square brackets with a multiplier outside, such as Ca(OH)2 or Al2(SO4)3. For hydrates, separate the water of crystallisation with an asterisk or a period and a leading coefficient, for example CuSO4*5H2O or Na2CO3.10H2O. Spaces are ignored. If a symbol is unrecognised or the brackets do not balance, the calculator returns a clear message rather than a wrong number.

Molar masses of common substances

SubstanceFormulaMolar mass (g/mol)
WaterH2O18.015
HydrogenH22.016
OxygenO231.998
NitrogenN228.014
Carbon dioxideCO244.009
AmmoniaNH317.031
MethaneCH416.043
EthanolC2H5OH46.068
Sodium chlorideNaCl58.44
Hydrochloric acidHCl36.458
Sulfuric acidH2SO498.079
Sodium hydroxideNaOH39.997
Calcium carbonateCaCO3100.087
GlucoseC6H12O6180.156
SucroseC12H22O11342.297
AspirinC9H8O4180.159
Sodium bicarbonateNaHCO384.007
Copper(II) sulfate pentahydrateCuSO4*5H2O249.685
Aluminum sulfateAl2(SO4)3342.154
Iron(III) oxideFe2O3159.688

Computed from standard IUPAC 2021 atomic weights. Type any formula in the box to see the full breakdown.

Frequently asked questions

What formula formats can I enter?

Type element symbols with subscripts, like H2O or C6H12O6. You can group units with parentheses or square brackets and a multiplier, such as Ca(OH)2 or Al2(SO4)3, and you can write hydrates with an asterisk or a period plus a coefficient, such as CuSO4*5H2O or Na2CO3.10H2O. Symbols must use a capital first letter and an optional lower-case second letter, so sodium is Na rather than NA. Spaces are ignored, and an unknown element or unbalanced bracket returns a clear message instead of a wrong answer.

How do I convert grams to moles or moles to grams?

Set the conversion mode to "Grams to moles" and enter your sample mass in grams; the calculator applies n = m / M. To go the other way, choose "Moles to grams" and enter a mole count; the calculator returns m = n times M. Both conversions update live as you change the formula or the quantity, so you can explore different compounds without re-entering data.

How do I count molecules or formula units?

Choose "Moles to molecules" or "Grams to molecules" from the conversion mode. The calculator multiplies moles by Avogadro's number, NA = 6.02214076 times 10^23 mol^-1, which is the exact value fixed by the 2019 redefinition of the SI mole. The result is the number of individual molecules (or formula units, for ionic compounds) in your sample.

What is the ideal-gas molar mass panel for?

It lets you identify an unknown gas from a simple experiment: seal the gas in a container, record pressure P, volume V, temperature T, and weigh the gas to get mass m. The rearranged ideal gas law M = mRT / PV gives the molar mass. This is useful in lab settings when the compound is a gas and its formula is unknown. The result is only accurate for ideal-gas conditions; light gases at low pressure and near room temperature behave most ideally.

What is the difference between molar mass and molecular weight?

They are numerically equal but conceptually different. Molecular weight, or relative molecular mass, is a dimensionless ratio comparing a molecule's mass to one twelfth of a carbon-12 atom. Molar mass is the mass of one mole of that substance and carries the unit grams per mole. Because the numbers match, the g/mol value this calculator reports is also the molecular weight, which is why the two terms are often used interchangeably.

Why might my value differ slightly from another source?

Small differences come from which atomic weights are used. This tool uses the conventional IUPAC 2021 standard atomic weights, the single representative value for each element. Some references quote more decimal places, slightly older values, or interval-based ranges for elements like chlorine and sulfur, so the last decimal can vary. For most coursework and lab work the difference is negligible. If you need exact isotopic masses, use a source that lets you specify the isotope.

Can I report molar mass in units other than g/mol?

Yes. Use the output unit selector to display the result in kg/mol (divide g/mol by 1000, common for polymer science), Daltons (Da), or atomic mass units (u). Daltons and atomic mass units are numerically the same as g/mol when using conventional atomic weights, so 18.015 g/mol for water equals 18.015 Da. The kg/mol value for water is 0.018015 kg/mol.

Sources

Written by Dr. Sofia Marchetti, PhD Chemist · Milan, Italy

Physical chemist and laboratory educator bringing rigorous solution science to accessible, accurate online tools.

Search 3,500+ calculators

Loading search…