The inhibitory effect of 3-allyl-6-bromo-2-(4-methoxyphenyl)-3H-imidazo[4,5-b]pyridine (P2) on corrosion of mild steel in aqueous 1 M HCl was investigated by weight loss method, potentiodynamic polarisation technique and electrochemical impedance spectroscopy (EIS). The inhibition efficiency of P2 on corrosion of mild steel in 1 M HCl solution increases on increasing in concentration of the P2. Potentiodynamic Polarization measurement indicates that P2 acts as a mixed-type inhibitor. The nature of adsorption of the P2 on mild steel surface is found to obey Langmuir adsorption isotherm. EIS measurement result is also correlated with the result of polarization. DFT study confirmed the adsorption of inhibitor molecules on mild steel surface.