Crude oil is a complex mixture of hydrocarbons and can contain various impurities, which vary depending on the source and geographical location from which it is extracted. These impurities include sulphur, nitrogen, some metals, asphaltenes, non-condensable gases and salts. Salts in oil are typically found in the form of ions, which means that they are dissolved in the water present in the crude oil, or in the form of solid salts that are later deposited in equipment, pipes, and ducts. These salts can be harmful because, when the oil is processed, the water present in the oil can separate from the hydrocarbons and cause corrosion of equipment in the oil refining plant. In addition, salts can form solid deposits that can obstruct equipment. It is therefore important to remove or reduce the presence of salts in oil during the refining process to avoid operational problems and problems with the quality of the refined product. Several occurrences are reported in the specialized literature of equipment failures in the oil refining industry involving corrosion by salts, especially ammonium chloride salts. Basically, ammonium chloride, whose chemical formula is NH4Cl, is an inorganic chemical compound consisting of ammonium ions (NH4+) and chloride ions (Cl−), It is known by several names, including “ammonium salt” or “ammonium salt” due to its composition. The aim of this paper is to investigate the failure of a shell-and-tube heat exchanger in the charge preheater system of the diesel hydrotreating unit of a Brazilian oil refinery, in which the root cause of the failure identified as responsible for the damage was ammonium chloride corrosion. A severe corrosive process was observed in the tubes of the tube bundle, including perforation in some tubes, as well as damage to the inside of the heat exchanger shell. The analysis methods employed involved the study of three different types of austenitic stainless steel in terms of corrosion resistance: 304, 316L and 317L, which were exposed to media containing sodium chloride and ammonium chloride at a concentration of 3.5 % (m/v). Two electrochemical corrosion tests were carried out in aqueous media, the first determining potentiodynamic polarization curves and the second electrochemical impedance spectroscopy. In addition to material characterization tests, such as determining the chemical composition, hardness and scanning electron microscopy of the corroded samples. The results of this paper indicate that the 317L steel samples have larger passivation regions, higher pitting potential values, lower passivation current density values, as well as lower corrosion rate values during the simulation of the equivalent electrochemical circuit, which implies greater resistance to corrosion in a medium containing ammonium chloride, compared to the others. The conclusions reached reveal the applicability of 317L austenitic stainless steel in environments containing ammonium chloride, such as in the diesel hydrotreating sections of oil refineries, in addition to the use of washing water in pipes and equipment to dissolve these salts. Due to the high corrosion resistance of 317L steel in media containing ammonium chloride, it could be extended to other refining sections, such as distillation, cracking and coking units in oil refineries. This research will enable potential gains in terms of increasing the operational life of equipment and installations, reducing corrective maintenance interventions and operational safety in the operation of the industrial plant.