Sulfur-doped carbon nanofibers (SCNFs) were prepared using chemical vapor deposition. In this line, different catalysts and various growth temperatures have been examined to obtain the optimized conditions. Among the employed catalysts, NiFe 2 O 4 showed the most performance, and the best quality of the prepared SCNFs was 600 °C. To enhance the electrochemical behaviors, the prepared SCNFs was decorated with gold nanoparticles using electrochemical deposition. Both products (doped and undoped) were fully characterized using common methods. Then, they used for the electrochemical detection of morphine using cyclic voltammetry and square wave voltammetry. The obtained electrochemical diagrams demonstrated the high efficiency of the synthesized product for sensing of morphine.