A rapid and sensitive electrochemical sensor for the simultaneous determination of oxycodone (OXY)and codeine (COD) has been proposed by utilizing the CoFe2O4nanoparticles modified carbon pasteelectrode (CFCPE). The morphology and structure of CoFe2O4nanoparticles (CFNPs) were investigatedby scanning electron microscopy (SEM), X-ray diffraction (XRD) and FT-IR spectroscopy. Electrochemicalcharacterization of the CFCPE was demonstrated with electrochemical impedance spectroscopy. Theresults indicated that CFCPE remarkably enhances the electrocatalytic activity of the electrode surfacetowards the oxidation of OXY and COD. The electrochemical oxidation of OXY and COD at the CFCPE wasstudied in detail using differential pulse voltammetry. The effect of various experimental parametersincluding pH, electrolyte composition and scan rate were investigated. At the optimum conditions, theconcentration of OXY and COD were determined using DPV in a linear range of 0.06–38 mol L−1and adetection limit of 0.05 mol L−1and 0.02 mol L−1, respectively. The proposed sensor exhibits a very fastresponse time (90 s) and good selectivity in the presence of Na+, K+, Ca2+, Mg2+, Cl−, NO3−, PO43−, SO42−,uric acid, citric acid, sucrose and glucose, uric acid, citric acid, sucrose, glucose, methadone and morphine.High stability, high sensitivity, and low detection limit made the proposed electrode applicable for theanalysis of various real samples.