BackgroundNon-alcoholic fatty liver disease (NAFLD) is associated with atrial fibrillation (AF). Insulin resistance (IR) is the main cause of the high prevalence of AF in NAFLD patients. The triglyceride-glucose index (TyG) is a novel IR-related indicator implicated in the incidence and severity of NAFLD. However, the role of TyG in determining the risk for AF in patients with NAFLD remains unclear.MethodsA retrospective study was conducted on 912 patients diagnosed with NAFLD via ultrasonography. These patients were divided into two groups: (1) NAFLD+ AF and (2) NAFLD+ non-AF. Least Absolute Shrinkage and Selection Operator (LASSO) regression was used to assess the correlation between the TyG index and the high risk for AF. A receiver operating characteristic (ROC) curve was constructed to evaluate the predictive value for the TyG index for AF. Restricted cubic splines (RCS) were used to test the linear correlation between TyG and the risk for AF.ResultsA total of 204 patients with AF and 708 patients without AF were included in this study. The LASSO logistic regression analysis showed that TyG was an independent risk factor for AF (odds ratio [OR] = 4.84, 95% confidence interval [CI] 2.98–7.88, P < 0.001). The RCS showed that the risk for AF increased linearly with TyG over the entire TyG range; this risk was also evident when the patients were analyzed based on sex (P for nonlinear > 0.05). In addition, the correlation between TyG and AF was a consistent finding in subgroup analysis. Furthermore, ROC curve analysis showed that TyG levels combined with traditional risk factors improved the predictive value for atrial fibrillation.ConclusionThe TyG index is useful in assessing the risk for atrial fibrillation in patients with NAFLD. Patients with NAFLD and increased TyG indices have higher risks for atrial fibrillation. Therefore, TyG indices should be assessed when managing patients with NAFLD.Supplementary InformationThe online version contains supplementary material available at 10.1186/s13098-023-01012-1.