Abstract An electrocatalytic based sensor fabricated for square wave voltammetric determination of methyldopa in the presence of tyrosine. For this goal, carbon paste electrode modified with NiO nanoparticle (NiO/NPs) and 2-(3,4-dihydroxyphenethyl)isoindoline-1,3-dione (DHPID) (CPE/DHPID/NiO/NPs) suggested as a highly selective sensor. The CPE/DHPID/NiO/NPs showed an excellent character for electrocatalytic oxidization of methyldopa in aqueous solution. For the mixture containing methyldopa and tyrosine, the oxidation peaks potential well separated from each other with differential potential ~ 500 mV. Methyldopa peak current increased linearly with its concentration at the ranges of 0.08–500 μM. The CPE/DHPID/NiO/NPs was successfully used for the analysis of methyldopa in drug samples.