Few things are as comforting as a chocolate. The right kind of chocolate offers many health benefits, one of which is the ability to boost your brain power.

Cocoa is rich in flavanols. These plant chemicals are found to some extent in nearly all fruits and vegetables. Flavanols are antioxidants that are anti-inflammatory and offer numerous health benefits including a lower risk of cardiovascular disease, high blood pressure, type 2 diabetes and cancer.

Dark chocolate contains more cocoa and flavanols than milk chocolate, so it provides more of cocoa's benefits.

Past studies have found that flavanols may improve mental function, but that health benefit has not been not well understood. University of Birmingham researchers designed a study to test the effects of the flavanols in chocolate on brain function and brain blood oxygenation.

Eighteen healthy men between the ages of 18 and 40 who were nonsmokers took part in the study that required them to undergo non-invasive brain imaging to measure the levels of blood oxygenation in their brains. The men underwent the test twice and drank a cocoa drink before and after. Following each test, the men completed an increasingly complex series of cognitive assessments. For one of the tests, flavanols were added to the cocoa drink.

Men who drank the flavanol-enriched cocoa beverage showed increased levels of blood to the brain faster and had the highest levels of blood oxygenation, up to three times more than the men who drank the beverage without added flavanols. The flavanol-enriched chocolate drink appeared to improve men’s functioning on the cognitive tests. Speed and accuracy were 11 percent faster in the men who consumed the enhanced drink.

“Our results showed a clear benefit for the participants taking the flavanol-enriched drink — but only when the task became sufficiently complicated,” explained Catarina Rendeiro, from the University of Birmingham's School of Sport, Exercise and Rehabilitation Sciences. “We can link this with our results on improved blood oxygenation — if you're being challenged more, your brain needs improved blood oxygen levels to manage that challenge. It also further suggests that flavanols might be particularly beneficial during cognitively demanding tasks.”

Some men did not benefit from the flavanol-enriched cocoa drink. They already had high levels of brain oxygenation, and that did not change nor did they perform better on the cognitive test. Rendeiro explained that in very fit individuals, there may be little room for improvement.

Not all chocolate is created equal. Before you get too excited about the health benefits of cocoa, or chocolate, you should know that milk chocolate is high in fat and sugar and can contain as little as 10 percent cocoa. Dark chocolate contains more cocoa and flavanols than milk chocolate, so it provides more of cocoa's healthy qualities.

Choose dark chocolate with a cocoa content of at least 65 percent to get the biggest health benefits. More cocoa means more antioxidants.

Chocolate is high in calories. You don’t want to add it to your diet without removing some other food or you could easily gain weight and wipe out much of cocoa’s benefits. Enjoy it in small quantities.

Cocoa isn’t the only source of flavanols. Red wine, apples, blueberries and bananas all contain high levels of these plant chemicals, too.

The study is published in Scientific Reports.