An electrochemical sensor based on molecular imprinted polymer (MIP) to detect ceftizoxime (CFX) with high sensitivity and selectivity is demonstrated. MIP was synthesized by electropolymerization of poly-cysteine (P-Cys) on a multi-walled carbon nanotube (MWCNT) modified glassy carbon electrode (GCE). A targeted drug was used as a template molecule during the polymerization process. The bare GCE was coated with a layer of MWCNT before the synthesis of MIP to improve the sensor sensitivity. Experimental parameters such as polymerization conditions, the influence of pH, molar ratio of the template molecules and the monomer molecules were all optimized. The peak potential exhibited linearity with CFX concentration in the ranges of 1 $$\times 10^{ - 9}$$ –1× $$10^{ - 7}$$ molL−1 (R2 = 0.9904) and 2× $$10^{ - 7}$$ –1× $$10^{ - 4}$$ molL−1 (R2 = 0.9949). The LOD of the MIP sensor was found to be $$1 \times 10^{ - 10}$$ molL−1 under optimal conditions using a differential pulse voltammetry (DPV). The proposed sensor was tested on real samples, and good recovery results were obtained.