Gather all ingredients.
Stir together sugar, cocoa, cornstarch, and salt in a saucepan. Place over medium heat, and stir in milk.
Bring to a boil, and cook, stirring constantly, until the mixture thickens enough to coat the back of a metal spoon.
Remove from heat, and stir in butter and vanilla.
Let cool briefly, and serve warm, or chill in the refrigerator until serving.
