The corrosion inhibition performances of four imidazolium-based corrosion inhibitors on mild steel in acidic medium, namely benzimidazole (BI), 2-aminobenzimidazole (ABI), 2-phenylbenzimidazole (PBI), and omeprazole (OP) were investigated in this work. The experimental results confirmed by electrochemical measurements and a scanning electron microscopy study show that OP may exhibit the best inhibitive performance among the four compounds for mild steel in sulfuric acid solution. Furthermore, quantum chemical calculations of density function theory (DFT) and molecular dynamics (MD) simulations were applied to theoretically determine the relationship between molecular structure and inhibition efficiency. OP shows the highest reaction activity among the four molecules. The binding energies of the corrosion inhibitor molecules and iron surface follow the order of OP > PBI > ABI > BI, which agrees well with the experimental findings.