Calcium and magnesium form undesirable soap-like salts with carboxylic acids in crude oil, acting as emulsifiers. Trace amounts of these metals, even though small, are harmful and necessitate removal. These salts cause sedimentation and blockages, while NaCl and MgCl2 generate corrosive HCl. Additionally, vanadium and nickel, concentrated in heavy residues, poison catalysts and require significant reduction via solvent extraction. Desalting is crucial to mitigate these detrimental effects.