Background Infections have been hypothesised to increase the risk of dementia. Existing studies have included a narrow range of infectious diseases, relied on short follow-up periods, and provided little evidence for whether the increased risk is limited to specific dementia subtypes or attributable to specific microbes rather than infection burden. We aimed to compare the risk of Alzheimer's disease and other dementias across a wide range of hospitaltreated bacterial and viral infections in two large cohorts with long follow-up periods.Methods In this large, multicohort, observational study, the analysis was based on a primary cohort consisting of pooled individual-level data from three prospective cohort studies in Finland (the Finnish Public Sector study, the Health and Social Support study, and the Still Working study) and an independent replication cohort from the UK Biobank. Community-dwelling adults (≥18 years) with no dementia at study entry were included. Follow-up was until Dec 31, 2012, in the Health and Social Support study, Dec 31, 2016, in the public sector study and the Still Working study, and Feb 7, 2018, in the replication cohort. Through record linkage to national hospital inpatient registers, we ascertained exposure to 925 infectious diseases (using the International Classification of Diseases 10th Revision codes) before dementia onset, and identified incident dementia from hospital records, medication reimbursement entitlements, and death certificates. Hazard ratios (HRs) for the associations of each infectious disease or disease group (index infection) with incident dementia were assessed by use of Cox proportional hazards models. We then repeated the analysis after excluding incident dementia cases that occurred during the first 10 years after initial hospitalisation due to the index infection.