One of the common methods to prepare nitriles is the dehydration of amides. This method requires strong dehydrating agents like phosphorous pentoxide or boiling acetic anhydride for converting amides to nitriles. Another reagent namely, thionyl chloride also accomplishes the dehydration of amides, where amide acts as a nucleophile. The first step of the mechanism involves the nucleophilic attack by the amide on the thionyl chloride to form an intermediate. In the next step, the electron pairs are rearranged by eliminating a chloride ion as a leaving group. In the subsequent deprotonation step, the positive charge on the nitrogen atom is removed. Finally, the second deprotonation releases sulfur dioxide and a chloride ion to yield a nitrile as the final product.
An alternative method for preparing nitriles is the reaction of a primary or unhindered alkyl halide with a cyanide ion via an SN2 mechanism to form a new carbon–carbon bond.
Additionally, aryl cyanides are prepared via a Sandmeyer reaction involving the treatment of aryldiazonium salt with cuprous cyanide.