
These are the best Harry Potter sorting hat cupcakes! They're moist chocolate cupcakes filled with the Hogwarts house colors and topped with mini sorting hats!
These Harry Potter cupcakes are the perfect treat for Halloween, a Harry Potter party or Harry Potter movie marathon! Any Harry Potter fan will love making and enjoying these fun cupcakes! I'm a Hufflepuff, and the very first cupcake I opened up, without knowing, was yellow! So I think it's safe to say these cupcakes really could tell you your true house!
If you're looking for other Harry Potter themed desserts to bring some real magic into your kitchen, try my butterbeer cupcakes, butterbeer cookies, butterbeer, polyjuice potion, pumpkin juice or pumpkin pasties!

Why You'll Love These Sorting Hat Cupcakes
They're super fun.
They're extra moist and chocolatey.
They're topped with cream cheese frosting.

Ingredients
- Flour- all purpose flour is used for the best crumb
- Sugar- granulated sugar goes in the cupcake batter and powdered sugar is used in the frostings
- Unsalted Butter- make sure it is softened
- Milk- helps to keep the cupcakes moist, make sure it's room temperature
- Sour Cream- I recommend full fat sour cream for the best textured cupcakes
- Cocoa Powder- I recommend using Dutch process for a deep chocolate flavor
- Espresso Powder- helps to enhance the chocolate flavor in these cupcakes
- Vanilla Extract- adds a sweet note to the cupcakes
- Eggs- make sure they're room temperature
- Baking Soda & Baking Powder- helps the cupcakes to rise and gives them their perfect fluffy texture
- Salt- brings out all the flavors in these cupcakes
- Cream Cheese- used to make the frosting and filling
- Gel Food Coloring- to make the filling the colors of the Hogwarts houses
- Oreos- used to make the sorting hat cupcake toppers
- Sprinkles- optional decoration

Step by Step Instructions
Please see the recipe card below for the complete measurements and baking time!
STEP ONE: In a medium bowl whisk together the flour, cocoa powder, baking powder, baking soda, salt and espresso powder. Then set aside the flour mixture.
STEP TWO: Cream the butter and sugar together in a large bowl with an electric mixer on high speed until fluffy, about 2-3 minutes. (You can also use the bowl of a stand mixer with the paddle attachment.)
STEP THREE: Then add in egg, egg yolk and vanilla and mix on medium-high speed until pale in color and smooth, about 1 minute.


STEP FOUR: Next mix in the milk and sour cream on low speed until combined. The mixture will look curdled but don't worry, it will pull together once the dry ingredients are added in.
STEP FIVE: Add the dry ingredients to the wet ingredients and combine on low speed. Scrape the sides and bottom of the bowl as necessary with a rubber spatula.


STEP SIX: Line a cupcake pan with cupcake liners, fill each cup ¾ of the way full and bake! (See recipe below for full measurements and baking time!) Let the cupcakes cool in the pan for 10 minutes, then transfer to a wire rack to cool completely.


STEP SEVEN: While the cupcakes are baking and cooling make the sorting hats. Make the frosting by adding softened, unsalted butter and salt to a medium sized bowl. Mix the butter with an electric mixer until it is pale in color and fluffy, about 5 minutes. (If using a stand mixer, use a whisk attachment.) Then sift in the cocoa powder. Mix until combined. Then sift in the powdered sugar a little at a time until it is all combined. The frosting will be thick at this point. Add in the heavy cream and mix until the frosting is light and fluffy, about 1-2 minutes. Transfer the frosting to a piping bag fit with a medium circular tip like Wilton __
STEP EIGHT: Remove the filling from 6 Oreos. Pipe the icing into the center of each Oreo to resemble the sorting hat. Move your piping hand in a very small circle to build up the frosting. I recommend practicing on a plate until you get the hang of it. It took me a few tries until it looked like the hat! Once all the hats have been made, pop them in the freezer until they are frozen solid.


STEP NINE: Once the hats are frozen, melt the chocolate and coconut oil together. Let the chocolate cool slightly until warm and liquid, but not super hot. Put the frozen hats on a wire rack on top of parchment paper. Spoon the chocolate over the hats until completely covered. While the chocolate is still liquid, carefully move each hat just a little bit so they're not sitting in a huge pool of chocolate. This will make it easier to remove them from the wire rack later. Let the hats sit until the chocolate is completely set. You can pop them in the fridge to speed this up.
STEP TEN: While the hats set, make the cream cheese frosting. Add the butter to a large bowl and whip on high speed until pale in color and fluffy, about 5 minutes. Then mix in the cold cream cheese. Add the powdered sugar in a little at a time until all is combined. Whip the frosting on high speed until light and fluffy.


STEP ELEVEN: Transfer about ½ cup (90 g) of frosting to four different bowls. Dye one bowl red, one gold, one blue and one green. (If you add in a little Dutch cocoa powder it really helps to deepen the colors.) Transfer each colored frosting to a piping bag and cut off a bit of the tip.
STEP TWELVE: Remove the center of each cupcake using a cupcake corer. Fill 3 cupcakes with red frosting, 3 with gold, 3 with blue and 3 with green.


STEP THIRTEEN: Rewhip if necessary, then transfer the remaining cream cheese frosting to a piping bag fit with a decorative tip. Pipe frosting on top of the cupcakes and sprinkle with sprinkles if you wish.


STEP FOURTEEN: Once set, place a sorting hat on top of each cupcake, then serve! Bite into one to reveal the hidden house colour and to be sorted!

FAQs
Do I have to make the sorting hats? No! You can leave them off, or even buy paper sorting hat cupcake toppers on Amazon to make it easier.
Is there an easier way to make the sorting hats? I've seen them made by attaching a Hershey kiss to an Oreo. Just put a little icing on the bottom of a kiss and pop it on the cookie!
Do I have to use espresso powder in these cupcakes? No, it's optional but it does help these cupcakes to have a richer chocolate flavor.
How long will these cupcakes stay fresh for? Store left overs in an airtight container in the fridge for up to three days. Let the cupcakes come to room temperature before enjoying so the frosting has a chance to become soft again.

Pro Tips
Measure your flour properly. This is always my #1 baking tip. Do not ever scoop a measuring cup into your flour. This will always lead to using too much flour. Instead, sprinkle spoonfuls of flour into your measuring cup and swipe excess flour off with the back of a knife. Or better yet, weigh your flour. 1 cup of flour equals 125 grams.
Let the sorting hats freeze completely before spooning the melted chocolate over top. This will ensure that the hats keep their shape and don't melt.
Make sure all your wet ingredients for the cupcakes are room temperature. This will yield the best cupcake texture. Cold wet ingredients can make the cupcakes "gummy" or not rise as well.

If you make these cupcakes please leave a star rating, it's so helpful for me! Tag me on Instagram @inbloombakery_ and TikTok @inbloombakery so I can see as well! Follow me on Pinterest for other dessert ideas!
Other Favorite Cupcake Recipes to Try Next Time
📖 Recipe

Harry Potter Sorting Hat Cupcakes
Ingredients
For the Chocolate Cupcakes
- 1 cup (125 g) all-purpose flour, spooned and leveled
- 5 tablespoon (25 g) Dutch process cocoa powder
- ½ teaspoon baking powder
- ½ teaspoon baking soda
- ¼ teaspoon salt
- 1 teaspoon espresso powder (optional)
- ¼ cup (56 g) unsalted butter, softened
- ¾ cup (150 g) granulated white sugar
- 1 egg, at room temperature
- 1 egg yolk, at room temperature
- 1 teaspoon vanilla
- ¼ cup (60 g) sour cream, at room temperature
- ½ cup (120 ml) whole milk, at room temperature
For the Sorting Hats
- ½ cup (112 g) unsalted butter, softened
- pinch of salt
- ¼ cup (20 g) Dutch process cocoa powder
- 1 cup (130 g) powdered sugar
- 2 tablespoon (30 ml) heavy cream
- 6 Oreos, with filling removed
- 6 oz dark chocolate bars, chopped
- 1 teaspoon coconut oil
For the Cream Cheese Frosting
- 1 cup (224 g) unsalted butter, softened
- 8 oz (226 g) cream cheese, cold
- 3 cups (390 g) powdered sugar
- blue, green, gold and red gel food coloring
- sprinkles for decorating
Instructions
For the Chocolate Cupcakes
- Preheat the oven to 350 degrees and line a cupcake pan with 12 cupcake liners.
- In a small bowl whisk together the flour, cocoa powder, baking powder, baking soda, salt and espresso powder. Then set aside.1 cup (125 g) all-purpose flour, spooned and leveled, 5 tablespoon (25 g) Dutch process cocoa powder, ½ teaspoon baking powder, ½ teaspoon baking soda, ¼ teaspoon salt, 1 teaspoon espresso powder (optional)
- Cream the butter and sugar together in a large bowl with an electric mixer on high speed until fluffy, about 2-3 minutes. (If using a stand mixer, use a paddle attachment.)¼ cup (56 g) unsalted butter, softened, ¾ cup (150 g) granulated white sugar
- Then add in egg, egg yolk and vanilla and mix on medium-high speed until pale in color and smooth, about 1 minute.1 egg, at room temperature, 1 egg yolk, at room temperature, 1 teaspoon vanilla
- Next mix in the milk and sour cream on low speed until combined. The mixture will look curdled but don't worry, it will pull together once the dry ingredients are added in.¼ cup (60 g) sour cream, at room temperature, ½ cup (120 ml) whole milk, at room temperature
- Add the dry ingredients to the wet ingredients and combine on low speed. Scrape the sides and bottom of the bowl as necessary with a rubber spatula.
- Divide the batter evenly among the 12 liners, each should be about three-quarters full. Bake the cupcakes for 17-19 minutes.Let the cupcakes cool in the pan for 10 minutes, then transfer to a wire rack to cool completely.
For the Sorting Hats
- While the cupcakes are baking and cooling make the sorting hats. Make the frosting by adding softened, unsalted butter and salt to a medium sized bowl. Mix the butter with an electric mixer until it is pale in color and fluffy, about 5 minutes. (If using a stand mixer, use a whisk attachment.) Then sift in the cocoa powder. Mix until combined. Then sift in the powdered sugar a little at a time until it is all combined. The frosting will be thick at this point. Add in the heavy cream and mix until the frosting is light and fluffy, about 1-2 minutes. Transfer the frosting to a piping bag fit with a medium circular tip like Wilton 2A.½ cup (112 g) unsalted butter, softened, pinch of salt, ¼ cup (20 g) Dutch process cocoa powder, 1 cup (130 g) powdered sugar, 2 tablespoon (30 ml) heavy cream
- Remove the filling from 6 Oreos. Pipe the icing into the center of each Oreo to resemble the sorting hat. Move your piping hand in a very small circle to build up the frosting. (I recommend practicing on a plate until you get the hang of it.) Once all the hats have been made, pop them in the freezer until they are frozen solid.6 Oreos, with filling removed
- Once the hats are frozen, melt the chocolate and coconut oil together. Let the chocolate cool slightly until warm and liquid, but not super hot. Put the frozen hats on a wire rack on top of parchment paper. Spoon the chocolate over the hats until completely covered. While the chocolate is still liquid on the hats, carefully move each hat at the base just a little bit so they're not sitting in a huge pool of chocolate on the wire rack. This will make it easier to remove them from the wire rack later. Let the hats sit until the chocolate is completely set. You can pop them in the fridge to speed this up.6 oz dark chocolate bars, chopped, 1 teaspoon coconut oil
For the Cream Cheese Frosting
- Add the butter to a large bowl and whip on high speed until pale in color and fluffy, about 5 minutes. Then mix in the cold cream cheese. Add the powdered sugar in a little at a time until all is combined. Whip the frosting on high speed until light and fluffy.1 cup (224 g) unsalted butter, softened, 8 oz (226 g) cream cheese, cold, 3 cups (390 g) powdered sugar
Assembling the Cupcakes
- Transfer about ½ cup (90 g) of frosting to four different bowls. Dye one bowl red, one gold, one blue and one green. (If you add in a little Dutch cocoa powder it really helps to deepen the colors.) Transfer each colored frosting to a piping bag and cut off a bit of the tip.blue, green, gold and red gel food coloring
- Remove the center of each cupcake using a cupcake corer. Fill 3 cupcakes with red frosting, 3 with gold, 3 with blue and 3 with green.
- Rewhip if necessary, then transfer the remaining cream cheese frosting to a piping bag fit with a decorative tip. Pipe frosting on top of the cupcakes and sprinkle with sprinkles if you wish.sprinkles for decorating
- Once set, place a sorting hat on top of each cupcake, then serve! Bite into one to reveal the hidden house colour and to be sorted!
Thank you so much for sharing this recipe! Made these cupcakes for my daughters Harry Potter birthday last night (she's 31!). She LOVED them and said they were the best cupcakes I've ever made... and I've made a LOT of cupcakes 🙂
Everyone was very keen to see which house they got... 2 dozen cupcakes disappeared pretty quickly!
Hi Shelley! Reading this makes me so happy! I'm so glad she loved them! Happy to connect with other HP fans through baking!! <3