In the present work, synthesis and characterization of 15 ionic liquids (ILs) derived from quaternary ammonium and carboxylates were carried out in order to proceed to their evaluation as corrosion inhibitors (CIs) of API X52 steel in 0.5 M HCl. Potentiodynamic tests confirmed the inhibition efficiency (IE) as a function of the chemical configuration of the anion and cation. It was observed that the presence of two carboxylic groups in long linear aliphatic chains reduced the IE, whereas in shorter chains it was increased. Tafel-polarization results revealed the ILs as mixed-type CIs and that the IE was directly proportional to the CI concentration. The compounds with the best IE were 2-amine-benzoate of N,N,N-trimethyl-hexadecan-1-ammonium ([THDA+][−AA]), 3-carboxybut-3-enoate of N,N,N-trimethyl-hexadecan-1-ammonium ([THDA+][−AI]), and dodecanoate of N,N,N-trimethyl-hexadecan-1-ammonium ([THDA+][−AD]) within the 56–84% interval. Furthermore, it was found that the ILs obeyed the Langmuir adsorption isotherm model and inhibited the corrosion of steel through a physicochemical process. Finally, the surface analysis by scanning electron microscopy (SEM) confirmed less steel damage in the presence of CI due to the inhibitor–metal interaction.