Preheat your oven to 180°C (350°F). Line a cupcake tin with paper liners, ready for baking.
Mix the dry ingredients: sift together the flour, cocoa powder, baking powder, and salt in a bowl. Set aside.
In a large mixing bowl, cream the softened butter and sugar using an electric mixer until the mixture is light, fluffy, and fragrant, about 3 minutes.
Add eggs one at a time to the creamed mixture, beating well after each addition, until the batter is smooth and slightly thickened.
Alternate adding the dry mixture and milk to the wet ingredients, starting and ending with the dry, mixing gently after each addition until just combined.
Divide the batter evenly among the cupcake liners, filling each about two-thirds full. Bake for 18-20 minutes, or until a toothpick inserted in the center comes out clean.
Remove the cupcakes from the oven and let them cool in the tin for 5 minutes, then transfer to a wire rack to cool completely. The cupcakes should be moist and springy to the touch.
While the cupcakes cool, prepare the frosting: beat softened butter until creamy, then gradually add the powdered sugar, vanilla, and milk, beating until smooth and stiff enough to hold peaks.
Fill a piping bag fitted with a cone tip with the frosting. Pipe a generous amount onto each cupcake, shaping it into a tall cone to resemble a witch’s hat.
Adjust the shape of the frosting to ensure the hats stand upright and have a pointed tip, creating a fun, spooky look.
Serve these adorable witch hats immediately or store them in an airtight container. Enjoy the soft, moist cupcake with the rich, decorative frosting for a festive treat!