ContextThis study aimed to investigate the association between night shift work and the risk of nonalcoholic fatty liver disease (NAFLD).MethodsWe conducted a prospective analysis of 281,280 UK Biobank participants. Cox proportional hazards models were used to estimate the association of night shift work with incident NAFLD. Polygenic risk score analyses were performed to assess whether a genetic predisposition to NAFLD modified the association.ResultsDuring a median follow-up of 12.1 years (3,373,964 person-years), 2,555 incident NAFLD cases were identified. Compared with workers who never/rarely worked night shifts, those who worked some night shifts or usual/permanent night shifts were 1.12 (95% CI: 0.96–1.31) and 1.27 (95% CI: 1.08–1.48) times more likely to develop NAFLD, respectively. Among the 75,059 participants who had reports on lifetime experience of night shift work, those with a longer duration, a higher frequency, more consecutive night shifts and a longer length per shift all showed higher risks of incident NAFLD. Further analyses showed that the association between night shift work and incident NAFLD was not modified by a genetic predisposition to NAFLD.ConclusionsNight shift work was associated with increased risks of incident NAFLD.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12889-023-16204-7.