Let’s discuss two strategies for preparing nitriles via substitution and dehydration reactions.
Synthesis of Nitriles via Substitution Reactions
To prepare a nitrile via a substitution reaction, we do an SN2 substitution of alkyl halides, mesylates, or tosylates with a cyanide salt such as NaCN or KCN:

Notice that from the tertiary alkyl halide, the reaction goes by SN1 mechanism even though the cyanide ion is a good nucleophile. This is because tertiary alkyl halides are too sterically hindered to undergo an SN2 substitution, and we use a polar protic solvent to facilitate the ionization of the carbon-halogen bond. The last reaction here is an example of forming diastereomeric products in SN1 reactions which happens when there is more than one chiral center in the substrate. You can read more about the stereochemistry of SN1 reactions here.
Another example of using the nucleophilicity of the cyanide ion to prepare nitriles is its reaction with aldehydes and ketones. The product of these reactions is a cyanohydrin:

Synthesis of Nitriles via Dehydration of Amides
The second approach for preparing nitriles is the dehydration of primary amides using SOCl2, POCl3, or P2O5:

There are several ways of preparing amides such as the reaction of carboxylic acids with amines using EDC or DCC coupling reagents.
Check Also
- Preparation of Carboxylic Acids
- Naming Carboxylic Acids
- Naming Nitriles
- Naming Esters
- Naming Carboxylic Acid Derivatives – Practice Problems
- Fischer Esterification
- Ester Hydrolysis by Acid and Base-Catalyzed Hydrolysis
- What is Transesterification?
- Esters Reaction with Amines – The Aminolysis Mechanism
- Ester Reactions Summary and Practice Problems
- Preparation of Acyl (Acid) Chlorides (ROCl)
- Reactions of Acid Chlorides (ROCl) with Nucleophiles
- Reaction of Acyl Chlorides with Grignard and Gilman (Organocuprate) Reagents
- Reduction of Acyl Chlorides by LiAlH4, NaBH4, and LiAl(OtBu)3H
- Preparation and Reaction Mechanism of Carboxylic Anhydrides
- Amides – Structure and Reactivity
- Naming Amides
- Amides Hydrolysis: Acid and Base-Catalyzed Mechanism
- Amide Dehydration Mechanism by SOCl2, POCl3, and P2O5
- Amide Reduction Mechanism by LiAlH4
- Amides Preparation and Reactions Summary
- Amides from Carboxylic Acids-DCC and EDC Coupling
- The Mechanism of Nitrile Hydrolysis To Carboxylic Acid
- Nitrile Reduction Mechanism with LiAlH4 and DIBAL to Amine or Aldehyde
- The Mechanism of Grignard and Organolithium Reactions with Nitriles
- Carboxylic Acids to Ketones
- Esters to Ketones
- Carboxylic Acids and Their Derivatives Practice Problems
- Carboxylic Acids and Their Derivatives Quiz