The features of this work on corrosion inhibition have been investigated based on the ecological awareness and according to the strict environmental legislations. This was done by studying how different imidazolium derivatives ionic liquids containing different alkyl chains R8, R10 and R12 affected the corrosion reaction of carbon steel specimen immersed in 1 M hydrochloric acid at various temperatures. Weight loss, potentiodynamic polarization and electrochemical impedance spectroscopy were utilized to examine the corrosion inhibition behavior on carbon steel. In addition, FT-IR spectroscopy was used to analyze the coated film that has been formed on the metal surface. The prepared ionic liquids showed effective inhibition efficiency, where the corrosion rate after the using of 100 ppm of R8-IL, R10-IL and R12-IL was decreased from 5.95 (µg cm−2 min−1) to 0.66, 0.56, and 0.44 (µg cm−2 min−1), respectively at 20 °C. In the polarization curves, the corrosion current, Icorr, decreases by ILs addition and suggest that ILs act as mixed type inhibitors. From EIS findings, the increase in Rct and decrease in Cdl values proves the adherence of inhibitor molecules on carbon steel surface. The temperature effect was also studied on the film formed, where increasing the temperature from 20 to 50 °C, the corrosion rate increased and the inhibitors efficacy decreased. The increasing in the length of the attached alkyl chain, the efficacies of the prepared inhibitors increases. Various thermodynamic parameters such as the reaction activation free energy (ΔG*), the entropy of activation (ΔS*), and the enthalpy of activation (ΔH*), as well as the adsorption isotherm were investigated in order to interpret the mechanism and obtain the most accurate perception.