What Is the Chemical Formula for Soap?

One original formula for soap is C₁₇H₃₅COONa, or sodium stearate, which would usually consist of wood ashes and animal fat. The wood ashes were responsible for providing the potassium carbonate and sodium while the animal fat component provides the triglycerides.

The purpose of soap is to have the hydrophobic part dissolve in grease, dirt or oils while the other part, being the ionic hydrophilic part, dissolves in water. So are typically made from treating animal or vegetable oils with a strong alkaline solution. They are mostly used for cleaning, washing and bathing, but are also an important part in many lubricants.