How to calculate the pH of a lye solution?

I'm trying to figure out if I can substitute the catholyte from a salt water electrolysis system for a lye solution in pretzel making. In order to figure this out, I need to know the pH of my lye solution, which seems like a pretty involved calculation. Can anyone explain how to calculate the pH of a 4% lye solution? (example: 40g lye in 1 liter water)

The exact number will depend on what exactly your lye is composed of. Lye usually refers to either sodium hydroxide (NaOH) or potassium hydroxide (KOH). For the purposes of the calculations I'm going to assume that it is sodium hydroxide.

Because molecules are really tiny things, chemists use larger units to count them, namely the mole. One mole of a compound contains 6.022 x 1023 molecules of it. It is like how a dozen eggs means 12, except that instead of 12, it's 6.022 x 1023.

One mole of sodium hydroxide happens to weigh 40 g (Ctrl-F "molar mass" on the Wikipedia article). So, the 40 g of lye that you are using contains one mole, or 6.022 x 1023 molecules, of NaOH.

Each single molecule of NaOH dissociates, or splits up, into one sodium ion and one hydroxide ion: Na+ and OH. The hydroxide ions are responsible for the corrosiveness of strong base, as well as the slippery feeling if you accidentally get some on your hands. In this solution, you're therefore going to have one mole of hydroxide ions.

You can now transform that into a concentration, which is defined by the amount of a substance, divided by the volume that it is in. Here, the amount is 1 mol and your volume is 1 L, so the concentration of OH is (1 mol)/(1 L) = 1 mol/L. Concentrations are commonly denoted with square brackets, so it's common to write [OH] = 1 mol/L.

Finally, we come to the last bit. The pH of a solution is given by pH = −log10[H+], where the square brackets [H+] denote the concentration of hydrogen ions, H+. There's a slight problem: the pH is looking for [H+], whereas we only know [OH]. Thankfully, it's also a known fact that whenever you use water as a solvent at room temperature, the following relationship holds true:

[H+] x [OH] = 10−14 mol2/L2

Therefore, [H+] = (10−14 mol2/L2)/(1 mol/L) = 10−14 mol/L. Taking the negative logarithm of this, you get pH = 14.

If your lye is actually potassium hydroxide, you'll need to run through all those steps again. The end result isn't very different, though; you'll get a pH of 13.85.