A comparative study on 1-dodecyl-2,3-dimethylimidazolium chloride ([DDMIM]Cl) and 1-benzyl-3-dodecyl-2-methylimidazol-1-ium chloride ([BDMIM]Cl) as corrosion inhibitors for N80 steel in a 15% hydrochloric acid solution was performed by surface tension tests, electrochemical measurements, weight loss, scanning electron microscopy, atomic force microscopy, and theoretical calculations. The experimental results confirm that [DDMIM]Cl and [BDMIM]Cl act as mixed-type inhibitors. The adsorption of both inhibitors on the N80 steel surface obeys the Langmuir adsorption isotherm, and [BDMIM]Cl exhibits better inhibitive performance, lower critical micelle concentration (CMC), and a lower ratio of saturation adsorption concentration on the steel surface to its own CMC than [DDMIM]Cl. The results of theoretical calculations reveal that the electron-donating/accepting capacities and hydrophobicity of the benzyl substituent in the imidazole ring are essential for preventing steel corrosion in acid media.