Out of baking chocolate halfway through a recipe? Unsweetened cocoa powder, sugar and a little fat will stand in for it in most bakes. Enter what the recipe asks for.

When a substitute works, and when it does not

Cocoa powder is chocolate with most of the cocoa butter pressed out. Adding fat back puts the richness back, which is why the swap works in batters and doughs, where the chocolate is one ingredient among many.

It does not work where the chocolate has to set on its own: dipping, coating, bars, bark or a ganache that must firm up. Those rely on cocoa butter’s crystal structure, which shortening or butter cannot copy.