We have seen earlier that nitriles are commonly prepared by several methods, including the Kolbe nitrile synthesis, which is the SN2 reaction of alkyl halides and cyanides, the Sandmeyer reaction, and the dehydration of primary amides using various dehydrating agents.

So, for converting an ester to a nitrile, the most intuitive way would be to convert the ester to an amide via a carboxylic acid and then dehydrate the amide using either SOCl₂ or POCl₃:
The second approach is reducing the ester with LiAlH₄ all the way to a primary alcohol and substituting the OH with a CN group by first converting it into a good leaving group:

There is also an interesting paper which uses PCl3 and I2 to convert esters to nitriles and ketones:

The mechanism of this conversion is beyond what I wanted to cover in this post, and it is probably not in your course as well, so I leave it to the more curious – J. Org. Chem. 2021, 86, 2028−2035
Organic Chemistry Reaction Maps
Never struggle again to figure out how to convert an alkyl halide to an alcohol, an alkene to an alkyne, a nitrile to a ketone, a ketone to an aldehyde, and more! The comprehensive powerfull Reaction Maps of organic functional group transformations are here!
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
