the invention provides a method for the preparation of fentanyl comprising : reacting 4 - piperidone hydrochloride monohydrate with aniline in presence of reducing environment to produce 4 - anilinopiperidine , reacting the 4 - ap as obtained from step with phenethyl halide under reflux conditions in highly alkaline medium to give 4 - anilino - n - phenethylpiperidine , and converting the 4 - anilino - n - phenethylpiperidine to fentanyl by reacting with propionyl chloride in presence of halogenated hydrocarbons , then isolating fentanyl by solvent extraction and purifying by crystallization from petroleum ether at a temperature ranging from 60 - 80 ° c .