Sipping a grande to celebrate National Coffee Day? That may bode well for your brain. New research published this week in a Gerontological Society of America journal suggests that consuming caffeine may lower your odds of of developing dementia or cognitive impairment—at least if you're an older woman.  

Scientists have long suspected that caffeine helps protect brain function, but that hunch was based on studies of animals, such as mice and rats. To test the theory out on people, Ira Driscoll, Ph.D., a psychology professor at the University of Wisconsin-Milwaukee, and some colleagues analyzed data from 6,467 women age 65 and older who were followed over 10 years. The women drank various amounts of caffeinated beverages, such as coffee, tea, and cola. Once a year, Driscoll and her team assessed the participants’ thinking skills and quizzed them about their caffeine consumption. Over the course of the study, 388 participants were diagnosed with cognitive decline, including dementia.

The women who reported consuming the most caffeine, an average of 261 mg or more per day—the amount in two to three cups of coffee of 8 fluid ounces, or five to six 8-ounce cups of black tea—were the least likely to develop dementia or impaired cognition. Overall, the well-caffeinated group reduced their risk of dementia by 36 percent, Driscoll says. The women who consumed the least caffeine, an average of less than 64 mg (less than a single cup of coffee), were most likely to be diagnosed with dementia.

How might caffeine work to reduce cognitive decline? Scientists aren’t exactly sure, but one theory is that it blocks specific chemical receptors in the brain called adenosine A2A receptors. As we age, those receptors can begin to function abnormally, affecting the regions of our brain that control learning and memory.

But Driscoll cautions that the link between higher caffeine consumption and lower rates of dementia isn't conclusive. “The mounting evidence of caffeine consumption as a potentially protective factor against cognitive impairment is exciting,” she says, but more research needs to be done before we understand, for example, the amount of caffeine that provides the best protection.

Until we have a clear answer, enjoy your coffee, tea, or even a bit of caffeinated peanut butter. But don’t overdo it: According to the Food and Drug Administration, 600 mg per day—the equivalent of two to four 8-ounce cups of most coffees—is too much. Health officials say that consuming up to 400 mg of caffeine per day is safe for most people.

And remember, your caffeine tolerance may be quite different from your coffee-break companion’s. If you start to feel nervous or jittery, it’s probably time to switch to decaf.