Three new cationic gemini surfactants with ester spacer type 2-2′-(ethane-1,2-diyl bis(oxy)) bis(N-(2-alkanamidoethyl)-N,N-dimethyl-2-oxoethan-1-aminium)) dichloride) (CGSES12, CGSES14 and CGSES16), based on N,N-dimethyl fatty amido ethylamine, were produced. These gemini quaternary ammonium salts were synthesized using a three-step reaction method, starting from th/e condensation of the fatty acid chloride (RCOCl) of various hydrophobic chain lengths (R, C11H23, C13H27, C15H31) with N,N-dimethyl ethylene diamine, followed by the quaternization of the tertiary amino group formed with the spacer of the ester group formed in the second step. The chemical configuration of the surfactants was established by FT-IR, 1HNMR, 13CNMR and Mass spectroscopies. The inhibition performance of three surfactants was studied by weight loss and electrochemical measurements. The results show that CGSES12, CGSES14 and CGSES16 behave as effective inhibitors and surface agents. The maximum efficiency was higher than 94% at 2.5 mM, and the inhibition order was CGSES16 > CGSES14 > CGSES12. This was due to the increment in hydrophobicity of the gemini surfactants. Their adsorption on a mild steel surface followed the Langmuir isotherm. CGSES12, CGSES14 and CGSES16 can be considered mixed-type inhibitors. The presence of CGSES12, CGSES14 and CGSES16 increased charge transfer resistance and decreased the corrosion rate. The adsorption focused on heteroatoms and the surface properties of cationic gemini surfactants.