The relationship between structure and corrosion inhibition of a series of 30 imidazol, benzimidazol, and pyridine derivatives has been established through the investigation of quantum descriptors calculated with PBE/6-311++G**. A quantitative structure−property relationship model was obtained by examination of these descriptors using a genetic functional approximation method based on a multiple linear regression analysis. Our results indicate that the efficiency of corrosion inhibitors is strongly associated with aromaticity, electron donor ability, and molecular volume descriptors. In order to calibrate and validate the proposed model, we performed electrochemical impedance spectroscopy (EIS) studies on imidazole, 2methylimidazole, benzimidazole, 2-chloromethylbenzimidazole, pyridine, and 2-aminopyridine compounds. The experimental values for efficiency of corrosion inhibition are in good agreement with the estimated values obtained by our model, thus confirming that our approach represents a promising and suitable tool to predict the inhibition of corrosion attributes of nitrogen containing heterocyclic compounds. The adsorption behavior of imidazole or benzimidazole heterocyclic molecules on the Fe(110) surface was also studied to elucidate the inhibition mechanism; the aromaticity played an important role in the adsorbate−surface complex.