The formula for soap is C17H35COONa or Sodium Stearate. Soaps are mostly sodium and sometimes potassium salts of fatty acids.