This study examined the association of caffeinated and decaffeinated coffee intake with cognitive function in a community-based sample of older adults in 1988-1992. Participants were 890 women with a mean age of 72.6 years and 638 men with a mean age of 73.3 years from the Rancho Bernardo Study. Cognitive function was assessed by 12 standardized tests, and lifetime consumption and current coffee consumption were obtained by questionnaire. After adjustment for confounders, higher lifetime coffee consumption in women was associated with better (p < or = 0.05) performance on six of 12 tests, with a trend (p < or = 0.10) on two other cognitive function tests; current caffeinated coffee intake was associated with better performance on two tests (p < 0.05), with a trend (p < 0.10) on one other test. Among women aged 80 or more years, lifetime coffee intake was nonsignificantly associated with better performance on 11 of the 12 tests. No relation was found between coffee intake and cognitive function among men or between decaffeinated coffee intake and cognitive function in either sex. Lifetime and current exposure to caffeine may be associated with better cognitive performance among women, especially among those aged 80 or more years.