If you make a dish where chocolate is the star, chances are good that the recipe will call for coffee in some form. It's known as a way to deepen chocolate flavor in cakes, cookies, and confections, and roughly 10% of the chocolate recipes in the EYB/CookShelf recipe library call for coffee or espresso as one of the ingredients. Serious Eats' Genevieve Yam looked into the science behind this common practice to give us the goods on why it works so well.

Beatty's chocolate cake from Barefoot Contessa at Home by Ina Garten calls for instant espresso powder and brewed coffee

The answer is chemically complex but simple to understand: both coffee and chocolate contain similar molecular compounds called pyrazines. These compounds are responsible for some of the roasted, nutty, and cocoa-like scents and flavors each offers. Chocolate and coffee "also share several key aroma compounds, including methylbutanals and methylpropanal molecules," according to food scientist Harold McGee.

“The distinctive smell of chocolate comes largely from methylbutanal, a branched amino-acid fragment that smells distinctly cocoa-like with a sweaty edge, and then from a bouquet of around 20 different pyrazines,” McGee wrote in his 2020 book Nose Dive: A Field Guide to the World's Smells. Knowing that they share so many scent and flavor compounds makes using coffee and chocolate together a no-brainer: adding coffee to desserts and confections will amplify the chocolate flavor.

Yam says she puts some type of coffee in almost everything she makes that is chocolate-forward. She will use 1/4 to 1/2 teaspoon of instant espresso powder or brewed coffee in place of some of the liquid called for in the recipe. If used judiciously, you won't taste the coffee as a separate flavor in the food. I have used it in cakes and cookies where people who don't like coffee have raved about the flavor.