Concentration Calculator
Four notations for one quantity — the conversions all hinge on density and molar mass.
The formula
molarity = 10 * percent(w/w) * density / molar mass
Where the ten comes from
A percent by mass is grams of solute per 100 g of solution. Multiplying by the density converts that to grams per 100 mL, and molarity wants grams per litre — a factor of ten — before dividing by the molar mass. Drop the density and the calculation simply cannot be done, which is why reagent bottles print it alongside the percentage.
The bench check
Concentrated sulfuric acid is sold at 98 % w/w with a density of 1.84 g/mL, and the formula returns 18.4 M. Concentrated hydrochloric acid at 37 % and 1.19 g/mL returns 12.1 M. Both agree with the figures on the label, which is the quickest way to confirm you have the conversion the right way up.
Which denominator?
Most of the confusion in solution work is not arithmetic but bookkeeping. Molarity divides by the volume of the finished solution; molality divides by the mass of the solvent; percent by mass divides by the mass of the solution again. The three agree closely in dilute water and diverge sharply in concentrated acid, which is why a bottle labelled 98 % is also labelled 18.4 M without contradiction.