Molarity is dependent on temperature, since the quantity of the solution is based on volume, and volume is a function of temperature.
The mass of a substance however is independent of temperature; this is what makes molality useful in a variety of situations that involve a drastic pressure or temperature change, which can change the solution's volume.
In such situations, the molarity would change, but the molality would remain unchanged. Thus, molality is often used in comparing and determining a solution's colligative properties.
Molality is a measurement of the concentration of a solution by comparing the moles of the solute with the kilograms of the solvent the solute is dissolved in.
If a solution of salt water contains 29 grams of sodium chloride (NaCl) and that salt is dissolved in 1000 grams of water, the molarity can be determined by converting the grams of sodium chloride to moles and dividing that by the mass of the water converted to kilograms.
Since the molar mass (gram formula mass of sodium chloride is 58 grams per mole ( Na = 23 g and Cl = 35 g , 23 + 35 = 58 g/mol) the mole value of the NaCl is 0.5 moles (29 g / 58 g/mol = 0.5 moles).
The mass of water is 1000 grams which is converted to 1.0 kg.
By definition, #"molarity"="moles of solute"/"volume of solution"#...and thus the units of #"molarity"# are #mol*L^-1#. On the other hand, #"molality"="moles of solute"/"kilograms of solvent"#...and thus #"molality"# is temperature independent given that mass, unlike volume, is UNAFFECTED by ambient pressure.
For dilute AQUEOUS solutions....#"molality"~="molarity"#.
In other scenarios, we need the solution density to calculate one from t'other, and vicey versy...