Prep your pans and oven. Line two baking sheets with parchment paper. Preheat the oven to 350°F (175°C).
Whisk dry ingredients. In a medium bowl, whisk flour, cocoa powder, baking soda, and salt until well combined. Set aside.
Cream the butter and sugars. In a large bowl, beat softened butter with granulated and brown sugars until light and fluffy, about 2–3 minutes.
This traps air for better texture.
Add eggs and flavorings. Beat in eggs one at a time. Mix in vanilla, peppermint extract, and espresso powder until smooth. The espresso should dissolve into the mixture.
Combine wet and dry. Add the dry ingredients to the wet in two additions, mixing on low just until no dry streaks remain.
Avoid overmixing.
Fold in chocolate. Stir in the chocolate chips or chunks with a spatula. The dough will be thick and fudgy.
Chill the dough. Cover the bowl and chill for 30–45 minutes. This prevents excessive spread and keeps the centers soft.
Shape the cookies. Scoop 2-tablespoon portions (a medium cookie scoop works well). Roll into balls and place 2 inches apart on prepared sheets.
Bake. Bake for 9–11 minutes, until edges look set and centers look slightly underdone.
They’ll finish setting as they cool.
Toppings. Immediately sprinkle with crushed peppermint and a pinch of flaky sea salt if using. Lightly press the peppermints so they stick.
Cool. Let cookies rest on the sheet for 5 minutes, then move to a wire rack to cool completely. The texture improves as they set.