We evaluated the association between nonalcoholic fatty liver disease (NAFLD) and incident atrial fibrillation (AF) and analyzed the impact of NAFLD on AF risk in relation to body mass index (BMI). A total of 8,048,055 subjects without significant liver disease who were available fatty liver index (FLI) values were included. Subjects were categorized into 3 groups based on FLI: < 30, 30 to < 60, and ≥ 60. During a median 8-year of follow-up, 534,442 subjects were newly diagnosed as AF (8.27 per 1000 person-years). Higher FLI was associated with an increased risk of AF (hazard ratio [HR] 1.053, 95% confidence interval [CI] 1.046–1.060 in 30 ≤ FLI < 60, and HR 1.115, 95% CI 1.106–1.125 in FLI ≥ 60). In underweight subjects (BMI < 18.5 kg/m2), higher FLI raised the risk of AF (by 1.6-fold in 30 ≤ FLI < 60 and by twofold in FLI ≥ 60). In normal- and overweight subjects, higher FLI was associated with an increased risk of AF, but the HRs were attenuated. In obese subjects, higher FLI was not associated with higher risk of AF. NAFLD as assessed by FLI was independently associated with an increased risk of AF in nonobese subjects with BMI < 25 kg/m2. The impact of NAFLD on AF risk was accentuated in lean subjects with underweight.