In a large saucepan, combine sugar, butter, and milk. Cook over medium heat, stirring constantly, until butter is melted and sugar is dissolved. Bring to a boil.
Boil without stirring for 5 minutes.
Remove from heat. Stir in cocoa powder and vanilla extract. Beat until thick.
Stir in chopped nuts, if using.
Pour into prepared pan and spread evenly. Let cool completely before cutting into squares.
Notes
Store fudge in an airtight container at room temperature.