Two triazole derivatives [1-phenyl-2-(5-(1,2,4) triazol-1-ylmethyl-(1,3,4) oxadizaol-2-ylsulphanyl)-ethanone (PTOE) and 2-(4-tert-butyl-benzylsulphanyl)-5-(1,2,4) triazol-1-ylmethyl-(1,3,4) oxadiazole (TBTO)] were synthesized as new corrosion inhibitors for the corrosion of mild steel in 1 M hydrochloric acid solutions. The inhibiting efficiency of the different inhibitors was evaluated by means of weight loss and electrochemical techniques such as electrochemical impedance spectroscopy (EIS) and polarization curves. The electrochemical investigation results indicate that these compounds act as mixed-type inhibitors retarding the anodic and cathodic corrosion reactions and do not change the mechanism of either hydrogen evolution reaction or mild steel dissolution. The studied compounds followed the Langmuir adsorption isotherm, and the thermodynamic parameters were determined and discussed. The effect of molecular structure on the inhibition efficiency has been investigated with ab initio calculations. The electronic properties such as highest occupied molecular orbital (HOMO) energy level, lowest unoccupied molecular orbital (LUMO) energy level, dipole moment (µ) and molecular orbital densities were calculated.