When fatty acids, like oils or fats are reacted with NaOH or KOH they form a water soluble salts called as Soaps. Soaps have a lipophillic tail and a hydrophilic head. The polar head makes the soap water soluble, while the tail helps in cleaning. When the Sodium or Potassium salts are reacted with MgCl₂ they form NaCl and KCl along with the Magnesium salt of fatty acid. This Magnesium salt formed is insoluble in water and forms a white precipitate. This precipitation is considered as the drawback of soaps and decreases the efficiency of soap. The overall reaction between soap and MgCl₂ is shown below.