Coffee's long-term effect on cognitive function remains unclear with studies suggesting both benefits and adverse effects. We used Mendelian randomization to investigate the causal relationship between habitual coffee consumption and cognitive function in mid- to later life. This included up to 415,530 participants and 300,760 coffee drinkers from 10 meta-analysed European ancestry cohorts. In each cohort, composite cognitive scores that capture global cognition and memory were computed using available tests. A genetic score derived using CYP1A1/2 (rs2472297) and AHR (rs6968865) was chosen as a proxy for habitual coffee consumption. Null associations were observed when examining the associations of the genetic score with global and memory cognition (β = -0.0007, 95% C.I. -0.009 to 0.008, P = 0.87; β = -0.001, 95% C.I. -0.005 to 0.002, P = 0.51, respectively), with high consistency between studies (Pheterogeneity > 0.4 for both). Domain specific analyses using available cognitive measures in the UK Biobank also did not support effects by habitual coffee intake for reaction time, pairs matching, reasoning or prospective memory (P ≥ 0.05 for all). Despite the power to detect very small effects, our meta-analysis provided no evidence for causal long-term effects of habitual coffee consumption on global cognition or memory.