Molarity and density are different ways of expressing essentially the same thing. Whereas density is the mass of a solid, liquid or gas divided by its volume, molarity is the number of moles of solute per liter of solution. A mole of a compound is the atomic masses of its component atoms in grams, and a liter is a measure of volume, so molarity is also a measure of density. Chemists prefer to use molarity because it allows many equations, such as the ideal gas law, to apply in broader circumstances. It makes some calculations easier, however, if all quantities are in units of density.

#### TL;DR (Too Long; Didn't Read)

Molarity is the number of moles of solute per liter of solution. Convert to density by multiplying the number of moles by the molecular mass of the compound. Convert density to molarity by converting to grams per liter and dividing by the molecular mass of the compound in grams.

## Defining a Mole and Molarity

A mole is a unit chemists use to measure mass. A mole of any compound has exactly the same number of particles as 12 grams of carbon-12, which is Avogadro's number (6.02 x 10^{23}) of particles. The mass of the same number of particles of any compound depends on the atomic masses of the atoms that form it. For example. a mole of hydrogen gas (H_{2}) has a mass of 2.016 grams, because the average atomic mass of all hydrogen isotopes is 1.008 AMU (atomic mass units). Similarly, a mole of methane gas (CH_{4}) has a mass of 16.043 grams, because the mass of carbon, when you consider all its naturally occurring isotopes, is 12.011.

Chemists use molarity to measure the concentration of a solute in solution. Molarity (M) is the number of moles of solute in a liter of solution. Sodium chloride (NaCl) has a molecular mass of (22.99 + 35.45) = 58.44 AMU, so if you dissolve 58.44 grams of table salt in a liter of water, you have a 1 M (1 molar) solution.

## Converting Molarity to Density

The molarity of a solute is a measure of the density of that solute, and you calculate one from the other fairly easily. Consider the example of 1 M solution of NaCl. It contains 58.44 grams of NaCl per liter of solution, so the density of NaCl in solution is 58.44 grams/liter. If you have instead a 1.05 M NaCl solution, simply multiply the molarity by the molecular mass of NaCl to find the density in grams per liter: (1.05 * 58.44) = 61.32 g/l. Calculations are usually easier if you convert density to grams/milliliter by multiplying the result by 10^{-3}. So 58.44 g/l becomes 0.05844 g/ml, and 61.32 g/l becomes 0.06132 g/ml.

## Converting Density to Molarity

The reverse procedure, converting the density of solute in solution to molarity, is not difficult. Convert the density of the solute to grams/liter, then divide the result by the molecular mass of the solute. For example, consider a solution in which the density of sodium chloride is 0.036 g/ml. Multiply by 10^{3} to convert to g/l = 36 g/l. Divide by the molecular weight of NaCl (58.44 g): 36 g/l รท 58.44 g/mole = 6.16 moles/l = 0.62 M.