The performance of two 1,2,4-triazole derivatives bearing an alkyl chain of variable length named 5-octylsulfanyl-1,2,4-triazole (TR8) and 5-decylsulfanyl-1,2,4-triazole (TR10) against mild steel (MS) corrosion in 1.0 M HCl was first evaluated utilizing experimental methods such as weight loss (WL), electrochemical impedance spectroscopy (EIS) and potentiodynamic polarization (PDP) techniques. Then, theoretical methods like Density Functional Theory (DFT) and molecular dynamics (MD) simulations were used to explore corrosion inhibition mechanisms. Effect of molecules on the MS surface was analyzed by scanning electron microscope (SEM) and atomic force microscopy (AFM). A correlation between corrosion inhibition properties and physicochemical and electronic properties as determined by DFT and MD was demonstrated. 1,2,4-triazole derivatives behave as effective inhibitors for MS corrosion in HCl at all concentrations tested with better efficacy at an optimal concentration of 10(-3) M. The maximum inhibition efficiencies (based on EIS results) were obtained 92% and 88% for TR10 and TR8, respectively. The adsorption is following the Langmuir isotherm model. Theoretical studies clearly showed that differences in carbon chain length alter inhibition performances of inhibitors and were found to be compatible with experimental results. (C) 2020 Elsevier B.V. All rights reserved.