Background: The purpose of this research was to investigate a possible link between night shift work and the development of all-cause dementia and Alzheimer's disease (AD), as well as determine the contribution of night shift work, genetic susceptibility to AD. Methods: This study was conducted using the UK Biobank database. 245,570 participants with a mean follow-up length of 13.1 years were included. A Cox proportional hazards model was used to investigate the link between night shift work and the development of all-cause dementia or AD. Results: We counted a total of 1248 participants with all-cause dementia. In the final multivariable adjusted model, the risk of dementia was highest in always night shift workers (HR 1.465, 95% CI 1.058–2.028, P = 0.022), followed by irregular shift workers (HR 1.197, 95% CI 1.026–1.396, P = 0.023). AD events were recorded in 474 participants during the follow-up period. After final multivariate adjustment of model, always night shift workers remained at the highest risk (HR 2.031, 95% CI 1.269–3.250, P = 0.003). Moreover, always night shift workers were associated with a higher risk of AD in both low, intermediate and high AD-GRS groups. Conclusions: Always night shift work had a higher risk of developing all-cause dementia and AD. Irregular shift workers had a higher risk of developing all-cause dementia than no shift workers. Always night shift work had a higher AD risk, regardless of whether they had a high, intermediate or low AD-GRS. [ABSTRACT FROM AUTHOR]