Metabolic syndrome may contribute to the rising incidence of multiple gastrointestinal (GI) cancers in recent birth cohorts. However, other than hepatocellular carcinoma, the association between nonalcoholic fatty liver disease (NAFLD) and risk of non-liver GI cancers is unexplored. We prospectively examined the associations of NAFLD risk with GI cancers among 319,290 participants in the UK Biobank (2006-2019). Baseline risk for NAFLD was estimated using the Dallas Steatosis Index, a validated prediction tool. Multivariable Cox models were used to estimate relative risks (RRs) and 95% confidence intervals (CIs) according to NAFLD risk categories: low (<20%), intermediate (20%-49%), and high (≥50%). We also examined the associations by age of cancer diagnosis (earlier onset [<60] vs. ≥60). A total of 273 incident liver cancer and 4789 non-liver GI cancer cases were diagnosed. Compared with individuals at low risk for NAFLD, those at high risk had 2.41-fold risk of liver cancer (RR = 2.41, 95% CI: 1.73-3.35) and 23% increased risk of non-liver GI cancers (RR = 1.23, 95% CI: 1.14-1.32) (all ptrend < 0.001). Stronger associations were observed for men and individuals who were obese (all pinteraction < 0.05). NAFLD-associated elevated risk was stronger for earlier-onset cancers. For each 25% increase in NAFLD risk, the RRs for earlier-onset cancers were 1.32 (95% CI: 1.05-1.66) for esophageal cancer, 1.35 (95% CI: 1.06-1.72) for gastric cancer, 1.34 (95% CI: 1.09-1.65) for pancreatic cancer, and 1.10 (95% CI: 1.01-1.20) for colorectal cancer. Conclusion: NAFLD risk was associated with an increased risk of liver and most GI cancers, especially those of earlier onset.