Little is known about the associations of magnesium (Mg) and calcium (Ca) with hemoglobin glycation index (HGI) and triglyceride-glucose index (TyG) in adults. In this study, we examined the associations of serum Mg and Ca with HGI and TyG in adults with coronary artery disease (CAD). This hospital-based cross-sectional study included 10757 CAD patients with a mean age of 61.6 years. Serum concentrations of Mg and Ca were measured in clinical laboratory. Overall, serum Mg and Ca were inversely associated with HGI and TyG. In multivariable analyses, Mg and Ca were inversely associated with HGI (Mg