In a small saucepan, combine 2 cups of milk, sugar, cocoa powder, and salt. Whisk until well combined. Cook over medium heat until very steam and just starting to simmer, stirring frequently.
Meanwhile, in a large mixing bowl, whisk together the egg yolks, cornstarch, and remaining ¼ cup of milk. When the chocolate milk is hot, slowly whisk about a cup into the egg yolk mixture. (This tempers the eggs to keep them from scrambling.) Whisk in the remaining hot milk. Pour the mixture back into the saucepan.
Place the saucepan back over medium heat and cook stirring constantly until the mixture bubbles. Continue cooking until thickened enough that the whisk leaves a trace when stirring in the mixture, about 3 minutes. (Temperature should be about 170F on an instant-read thermometer.) Remove from the heat and whisk in the butter and vanilla until melted and combined.
Transfer the pudding to a bowl and press plastic wrap to the surface. Refrigerate until chilled, about 3 hours, or up to 4 days. Give it a good stir before dishing into serving bowls. Serve with whipped cream, if desired.
Video
Notes
Make sure you whisk the mixture constantly, as you do not want the chocolate to stick to the pan.
When wrapping the pudding to chill, make sure to press the plastic wrap directly onto the surface to prevent a skin from forming over the top of the pudding.
As the pudding sets, it becomes a little dense. Make sure to stir the pudding before serving to help aerate it.
Use real vanilla extract for the best flavor. Try making my homemade vanilla extract ahead of time! It is so flavorful.
Make sure you slowly pour the chocolate mixture into the egg mixture, and not the other way around. This will prevent the eggs from cooking from the heat.
To make chocolate shavings for the topping, you can scrape the chocolate bar with a knife on an angle before chopping it to melt.
You can chill the pudding faster if you portion them out into individual containers ahead of time. Again, make sure to press the plastic onto the pudding as it chills.