The logarithmic pH scale ranges from 0 to 14 and expresses the acidity of solution. A pH less than 7 is acidic. A pH greater than 7 is basic. Mathematically, pH is the negative logarithm of the molar concentration of hydrogen ions (H+) in the solution; pH = - Log (H+). Sodium hydroxide (NaOH) is a strong base that completely dissociates in the water according to the equation: NaOH =Na(+) + OH(-). The product of the concentrations of two ions H(+) and OH(-) in the solution is constant: H(+) x OH(-) = 10^(-14).

Divide the mass of NaOH in the solution by the molar weight (40) of the compound to calculate the number of moles. For example, if you have 2 g of NaOH dissolved in 500 ml of water, then the formula is 2 / 40 = 0.05 moles.

Divide the number of moles of NaOH by the volume of the solution (in liters) to calculate the molar concentration of NaOH. In this example, the volume of the solution is 500 ml, or 0.5 L; the molar concentration is 0.05 / 0.5 = 0.1

Divide the number 10^(-14) by the molar concentration of NaOH to calculate the concentration of hydrogen ions (H+) in the solution. In this example, the concentration of H+ is 10^(-14) / 0.1 = 10^(-13).

Take the logarithm of the concentration of hydrogen ions, and then multiply it by -1 to calculate the pH. In this example, pH is (-1) x log(10^-13) = -1 x (-13) = 13.