Carboxylic acids, when treated with SOCl2 or PCl5, result in acid chlorides. Here, the –OH group of the carboxylic acid is replaced by –Cl. The reaction mechanism begins with a nucleophilic attack of the carboxylic acid on thionyl chloride to generate an intermediate that immediately loses a chloride ion. Subsequent deprotonation forms a reactive chlorosulfite derivative bearing a good leaving group. The derivative then undergoes a nucleophilic attack by the chloride ion to form a tetrahedral intermediate. Finally, with the departure of the leaving group, acid chloride is formed as a product. Treatment of carboxylic acids with PCl5 also produces acid chloride along with phosphorus oxychloride that bears a highly stable P=O bond which drives the reaction forward. In acid chlorides, the presence of both electron-withdrawing atoms makes the carbonyl carbon highly electrophilic and reactive. Acid chlorides can undergo nucleophilic acyl substitution via the addition–elimination mechanism to generate acid derivatives.