Zinc oxide nanoparticles (ZnONPs) are used to modify carbon paste electrodes for a fast, stable, and sensitive electrochemical determination of difloxacin HCl in pharmaceutical formulation and their photodegradation rate. The small particle size and large surface area of ZnONPs enhance the diffusion rates of the chosen target analyte to many accessible binding sites, increasing the range of the linear structure with a low detection limit and improving the stability and lifetime of the electrode. An initial optimization study included sixteen modified carbon paste electrodes to achieve optimal electrode composition in carbon paste composition, plasticizer type, and the amount of ZnO nanoparticles added as a modifier. We studied the performance parameter of two electrodes, one with ZnONPs (E11) and the other without (E5) to evaluate using ZnONPs as a modifier. The optimized electrode is electrode number eleven (E11), with a paste composition of 39% graphite powder, 39% dibutyl phthalate (DBP) as a plasticizer, 15% difloxacin HCl-sodium tetraphenylborate (DIF-TPB) ion-pair as an ion exchanger, and 7% zinc oxide nanoparticles (ZnONPs) as a modifier, it maintained a Nernstian response over 4 months, with a slope of (57.0 ± 0.4) over the linearity concentration range 6.3 $$\times$$
×
10−6–10−2 M with a correlation coefficient (r2) ≥ 0.998 and detection limit 6.3 $$\times$$
×
10−6 M within pH range 2–5. The applications of the proposed electrodes are the determination of difloxcine HCl pharmaceuticals formulation and their photocatalytic degradation rate in water samples. The statistical comparison shows no significant difference in accuracy or precision between the reported and the proposed methods.
Graphical Abstract