This work is devoted to examine the effectiveness of pyrazoles 4-(4,5-dihydro-1H-pyrazol-5-yl)-N,N-dimethylaniline (D) on corrosion of mild steel in a 1 M HCl solution, using weight loss measurement at concentration effects. The inhibitor (D) was synthesized in our laboratory. The formation of this pyrazole was carried out with hydrazine and α-unsaturated aldehydes, and the structure was checked by spectroscopic means, such as FT-IR, 1H NMR and 13C NMR. Polarization curves and electrochemical impedance spectroscopy (EIS) methods were used to assess both the corrosion rate and inhibition efficiency. Potentiodynamic polarization showed that D behaved as a mixed-type inhibitor. The Nyquist plots showed that, while D concentrations increased, charge-transfer resistance increased and double-layer capacitance decreased, involving increased inhibition efficiency. Adsorption of the inhibitor molecules corresponds to Langmuir adsorption isotherm. Quantum chemical calculations showed that the inhibitor was prone to be protonated in the acid, and the results were in full agreement with experimental observations.