This study aimed to examine the associations of body mass index (BMI) across adult life with cognitive function in 2,637 participants aged 60 years or over from NHANES 2011-2014. The primary outcome was a composite score based on test scores on word list learning, animal naming, and digit symbol substitution. Exposures of interest included BMI at age 25, BMI 10 years before the survey, BMI at the survey (current BMI), and BMI burden calculated from age 25 to age at survey. BMI at age 25 was inversely associated with the composite score (β=-0.0271±0.0130 per kg/m2, P=0.038) and positively with low cognitive performance (odd ratio=1.04, 95% confidence interval: 1.01-1.07, P=0.010), defined as below 20 percentile of the composite score. Similar results were observed for BMI 10 years before the survey and BMI burden. Current BMI was positively associated with the composite score (β=0.0369±0.0113, P=0.001) and inversely associated with low cognitive performance (odd ratio=0.96, 95% confidence interval: 0.94-0.99, P=0.004). In conclusion, high BMI in early adult life is associated with low cognitive function in late life, which underscores the importance of a healthy body weight across the life course. The association between BMI and cognitive function at late life requires further investigation.