Why Is Milk White?: & 200 Other Curious Chemistry Questions (2013)
3. Household Chemistry
Where does soap come from?
To make soap, take oil or fat and chemically add something that loves water to one end. Lye loves water. Lye is sodium hydroxide, a very powerful alkali. You can tell when a substance is strongly attracted to water because it releases heat when it reacts with water. When you add lye to water, the water gets very hot.
An alkali is the opposite of an acid. Acids and alkalis react strongly to produce salts. A fat or oil is three fatty acids attached to a molecule of glycerin. Adding lye to the fat allows the alkali to react with the fatty acids. The fatty acids are broken away from the glycerin and react with the lye to form soap. The glycerin is left behind.
The sodium part of the lye is now attached to the long chain of carbons that used to be a fatty acid. The sodium is still strongly attracted to water molecules, and the fatty acid end of the soap molecule ends up on the other side of the water surface, either in the air or in the oil.