The corrosion behavior of mild steel was studied in 1 M HCl solution containing varying amounts of triazine derivatives having amine groups and alkyl carboxylic acid groups. The synthesized triazine derivatives were characterized by Fourier transform infrared (FT-IR) spectroscopy, NMR, mass spectroscopy, and elemental analysis (EA), and their corrosion inhibition properties were determined by potentiodynamic polarization and electrochemical impedance spectroscopy (EIS) techniques. We found that the triazine derivatives acted as mixed-type inhibitors by their adsorption on the metal surface. We also proposed that the Langmuir adsorption isotherm model could be used to explain the adsorption of triazine derivatives. In addition, when the alkyl chain length of the triazine derivative was relatively long, we also obtained a high-adsorption equilibrium constant and low Gibbs free energy of adsorption. Thus, we conclude that the alkyl chain length plays an important role in the corrosion inhibition properties of triazine derivatives.