Place butter in the bowl of a stand mixer with paddle attached. Beat for 3 minutes on speed 7 until it becomes pale.
Add half the icing sugar and cocoa powder. Beat for 3 minutes - start slow, increase to speed 7.
Add remaining icing sugar and cocoa powder. Beat again for 3 minutes.
Add milk and vanilla if using. Beat again for 1 minute on speed 7.
Spread onto cakes / cupcakes, or spoon into frosting bag and pipe.