Heat the oven to 350°F (175°C). Line an 8x8-inch metal baking pan with parchment paper, leaving an overhanging sling on two sides.
Combine the chopped chocolate and butter in a large heatproof bowl. Melt gently over simmering water (or in short microwave bursts), stirring until glossy, then cool slightly.
Whisk both sugars into the cooled chocolate mixture. Add the eggs one at a time, whisking vigorously for a full minute after the last one, until the batter is thick and glossy.
Stir in the vanilla. Sprinkle the flour, cocoa powder, salt and espresso powder over the batter and fold until just combined, then fold in the chocolate chips if using.
Scrape the batter into the prepared pan and smooth the top. Bake for 28 to 32 minutes, until the edges are set and a toothpick inserted in the centre comes out with moist crumbs.
Cool completely in the pan on a wire rack for at least 1 hour (2 hours is better) before lifting out with the parchment sling and cutting into 16 squares.