In a heavy saucepan, stir together 3 cups granulated sugar, 2/3 cup unsweetened cocoa powder, and a pinch of salt. Add 1 and 1/2 cups whole milk and cook over medium heat while stirring continuously for about 15 minutes.
Reduce the heat and continue cooking without stirring for about 30 minutes.
Remove from the heat and add 1/4 cup butter and 1 teaspoon vanilla. Let it cool.
Once the mixture cools, beat it with a wooden spoon for about 6-8 minutes.
Spread it in an 8-inch square pan, greased and lined with parchment paper. Let it cool overnight. Cut into squares and store in an airtight container.