This bright and cheerful rainbow cake features six cake layers enrobed in smooth Swiss buttercream.

I think this is the perfect celebration cake for all occasions! On the outside it seems like a boring vanilla white cake. But once you slice into it, you get this surprising happy pop of color and excitement.
Rainbow cakes are great for parties and gatherings. They’re an instant crowd-pleaser! The harmony of colors appeals to everyone, young and old alike. Best of all, you can easily customize the colors to your liking or swap in different flavors or fillings.

Ingredients
This cake recipe starts with a simple vanilla cake base. Butter and vanilla are the two main ingredients that flavor this cake. As such, it is vital to use fresh butter and high quality vanilla.
The cake base is made with egg whites to produce a white cake base that allows the different colors to shine. You will need the standard cake ingredients of: sugar, flour, baking powder, baking soda, milk, and sour cream.
Coloring Cake Layers
There are several ways to color the cake. Use soft gel paste food coloring to achieve the most vibrant colors. DO not use liquid food coloring. The batter will be too thin. It will not bake off properly.

This rainbow cake recipe was specifically created for artificial dye gel food colors.
- For vibrant colors: AmeriColor Soft Gel Paste Food Color in super red, lemon yellow, electric orange, electric green, electric blue, and royal purple.
- For neon colors: use Chefmaster Neon Liqua-gel food color in neon brite pink, neon brite orange, neon bright yellow, neon brite green, neon brite blue, and neon brite purple.
I have tested this recipe with food gels made with vegetable colorants (this India Tree color set). See results below.




Step-by-Step Instructions





Recipe Tip
Cake layers may be baked ahead of time. Cool to room temperature. Individually wrap the layers in plastic wrap. Store in the freeze for up to one month. Defrost at room temperature.
Cake Assembly





Serving Suggestions
Store assembled frosted cake in the fridge until ready to serve, up to three days in advance. Take note of any highly aromatic flavors in the fridge such as onions, garlic, fermented foods, or blue cheese that may seep into the cake.
Use a sharp knife to make clean cake slices. Wipe the blade between cuts to ensure clean lines.
A cold cake will be easier to slice. However, let the cake sit out for at least 15-30 minutes before serving for best flavor and texture. The buttercream and cake need time to soften.
Rainbow cake is delicious on it’s own! Make it even better with decorative garnishes such as fresh berries, cut fruit, or edible flowers. And of course, it’s wonderful with a scoop of ice cream on the side!

More Celebration Cake Recipes
- Coconut Confetti Cake
- Chocolate Butter Mochi Cake
- Birthday Cinnamon Roll Cake
- Funfetti Doughnut Cake
Rainbow Cake

Ingredients
Cake:
- 1 cup unsalted butter, (227 g), room temp
- 2 cups granulated sugar, (400 g)
- 5 large egg whites, (165 g) about ⅔ cup, room temp, lightly whisked
- 1 ½ teaspoon high quality pure vanilla extract, or vanilla paste
- ½ cup sour cream, (120 g), room temp
- 3 cups all-purpose flour, (390 g)
- 1 Tablespoon baking powder, (12 g)
- 1 teaspoon baking soda, (5 g)
- ½ teaspoon kosher salt, or fine sea salt
- 1 cup whole milk, (227 g)
- soft gel paste food colors*, see notes
Swiss Buttercream:
- 6 large egg whites, (210 g), about 1 cup
- 1 ½ cup granulated sugar, (300 g)
- 2 cup unsalted butter, (454 g), sliced into tablespoons, softened
- ½ teaspoon kosher salt, or fine sea salt
- 1 teaspoon high quality pure vanilla extract, or vanilla bean paste
Instructions
- Preheat oven to 350℉. Gather as many 8-inch round cake pans as you can find. Butter and line the cake rounds with parchment paper rounds. Set aside.NOTE: You may bake the layers in batches if you don't have enough cake pans. Clean cake pans between baking.
- In a bowl of a stand mixer with the paddle attachment, cream butter. Add sugar and continue to cream until lighter in color. Slowly add egg whites to the butter on low-medium speed. Add vanilla and sour cream. Mix until thoroughly combined.
- In a medium bowl, whisk together flour, baking powder, baking soda and salt. Alternate adding flour mixture and milk to the creamed mixture. Add the flour in three additions, beginning and ending with the flour.
- Use a kitchen scale to weight cake batter. Take the weight and divide it by 6. (My total weight was 1530 grams. Divide by 6, it was 255 grams.) Measure out equal amounts of batter into 6 small bowls. Note: If you don’t have a scale, it was roughly 3/4 cup of batter into 6 bowls.
- Add food coloring to individual bowls. I used about 4-8 drops of coloring for each. Some colors required more gel than others to get the vibrant hues I wanted. Be sure to use food gels. Adding liquid food coloring will make your batter too runny and thin.
- Transfer colored batter to prepared cake pan. Bake for 13-15 minutes until cake is set. Let cool in pan for 3 minutes before unmolding and allowing to cool completely on the racks. Continue to bake off cakes until you have completed all six colors.
Buttercream:
- Whisk together egg whites and sugar in the bowl of stand mixer. Place bowl over a pot of simmering water to create a bain-marie or double boiler. Make sure the simmering water does not touch the bottom of the bowl. Whisk mixture until it reaches a temperature of 160°F.*Alternatively, if you don't have a thermometer, heat the mixture until all the sugar has melted. Test this by dipping your pointer finger into the mixture and rubbing it against your thumb. The mixture should feel smooth. You should not be able to feel the granules of sugar.
- Return bowl to stand mixer. Using the whisk attachment, beat mixture at medium speed until it has cooled to room temperature (about 75-80°F) and meringue has started to form.
- Reduce to low speed. Add butter one tablespoon at a time. Add salt and vanilla. Increase speed to medium-high and continue to beat until buttercream is light and fluffy.
Assembly:
- Place the purple layer of cake on a cake board. If desired, lightly soak cake layer with simple syrup (or other flavored syrup). Spread about 1/4 cup buttercream on cake.
- Repeat adding syrup and buttercream on remaining layers (blue, green, yellow, orange, and red).
- Spread a thin layer of buttercream around the sides of cake to seal in the crumbs (crumb coat). Place in the fridge and allow to chill for 15 minutes to set buttercream.
- Coat cake with final thicker layer of buttercream. Decorate cake as desired. Store cake in the fridge until ready to serve.
Notes
- For vibrant colors use AmeriColor Soft Gel Paste Food Color in super red, lemon yellow, electric orange, electric green, electric blue, and royal purple. Be sure to use food coloring GEL. Please do not use liquid food coloring. The batter will be too thin and not bake off properly.
- For neon colors use Chefmaster Neon Liqua-gel food color in neon brite pink, neon brite orange, neon bright yellow, neon brite green, neon brite blue, and neon brite purple.
- I have tested this recipe with food gels made with vegetable colorants. Unfortunately, the heat from baking chemically alters the colors, making them very muted.
- Recipe makes just enough buttercream to coat cake with a thin layer. If you have a heavy hand with frosting- I suggest doubling the buttercream recipe. Excess buttercream may be stored in the freezer for up to a month.
- If you add the butter when the meringue is too hot, it may melt and the buttercream may not emulsify. If this happens, place the mixing bowl in the freezer for a couple minutes to cool down the mixture. Once cooled, started whipping again.
- If the butter is too cold when added to the meringue, the buttercream may end up chunky. Use a torch to warm the bowl or place over a bain-maire to soften the butter.
Nutrition
Nutrition information is automatically calculated, so should only be used as an approximation.

Hi! I’m from Peru and I just made the cake today! it was my first time doing the rainbow cake, and everything was all right, the cake was delicious!
The only thing we didn’t like was the meringue…I think 18 oz of butter is too much! is the recipe correct or maybe yo made a mistake writing it? I will try the next time with half the amount of butter.
Thnks for sharing it!
I made this cake yesterday for my wife’s 30th birthday, and man! Wow! It was the first time I made a cake not from the box, though I confess that I cheated and used store-bought frosting.
The batter was extremely thick, and I think as a result, the cake came out dense, but maybe all from-scratch cakes are like that? I used the same food coloring gel as you, but the colors weren’t as vibrant as yours.
I think also, because the batter was so thick, I had a hard time getting it level in the pans, so some of the layers baked up unevenly.
Overall, though – fantastic! Thank you for posting this recipe!
That’s awesome! Thank you for trying out the recipe. What a wonderful surprise for your wife! (Happy belated birthday!)
I used quite a lot gel coloring to get it that vibrant color. Using an mini offset spatula really helps to level the batter in the pans. If that doesn’t work, give the batter filled pans a good thump on the counter to loosen it up.
The cake is naturally more dense than most cakes to allow for better stacking. So don’t worry, you made it correctly :)
Hello!
I’m from Spain and a stick of butter here has 250 gr. So how many grams of butter should be used for cake recipe?
Thanks a lot!
Hi Sonia. Each stick of butter is 4 oz. 1 1/2 sticks would be 6 oz and I think that converts to 160 grams.
This is just an absolutely lovely cake! I’m planning on making it for Easter, replacing the red layer for a bright pink! Do you think I can color the frosting a light pink? And does the icing harden, or does it stay sticky? I want to add some Easter decoration to it, like possibly dying some coconut green and adding some jelly beans. Maybe some marshmallow chicks. Can you please help me with answers to these questions so I know ahead of time what I need to do. Thank you so much, and I really enjoy your blog! Thank you for this recipe, and also, I loved your comments…I agree wholeheartedly! No one has the right to decide how another should live.
Yes, you should color the frosting with pink gel color. Using the liquid food coloring might make your frosting watery and thin. The buttercream doesn’t get hard unless you chill it in the fridge for a couple of hours. I suggest adding the decorations after you’ve done your final coat of icing and before you put it in the fridge. Be careful with the jelly beans in the fridge, they might transfer some color onto light color frosting. Your cake is going to look so festive! :)
Hi – just wondering. did you double the recipe quantities? My slivers are about 1cm high using the measurements specified? Any indication would be greatly appreciated. Thanks :)
Hi! No, I did not double the cake recipe. I used a 9-inch cake round to do each layer.
I suggest adding some salt to the buttercream, and vanilla extract/paste or citrus zest… something to give it some kind of flavor. If you want the vibrancy of the cake colors like in the picture you will need to add quite a bit of gel paste, especially to the red, blue and purple. What you see raw is mostly what you will get baked, so don’t be shy with colors. I used parchment in the bottom of three cake pans and reused the parchment for the second time around, and I didn’t wash my cake pans between uses. This cake came together very easily.
HI,I am vegetarian and we don’t even eat eggs, i really like your cake its so perfect can you please suggest how to make eggless rainbow cake and eggless butter cream, i want to make this cake for my dougther next birthday please help me,
thank you
I tried this today…. and have a couple of questions. First, your colours are much more vibrant then mine. I used gel food colouring… did I not use enough, or is there a trick to the vibrancy? Second… my layers kept sliding off! what’s the trick to keeping them all stacked properly, no slipping and sliding? :) It was fun to make – the kids helped and loved watching it go together! Thanks for the tutorial! :)
Hi Rachel. Thanks for trying out the recipe! I used Americolor Soft Gel Food Paste coloring. I used their electric colors series because I find them to bake more vibrant that their regular colors. I used no more than 1 tsp of each gel color.As for the layers, make sure each cake layer is flat level. I had to trim off some of cake tops. Also, make sure the layer of frosting on top of each cake layer is flat and level. You could also press down on each layer of cake as you build it to ensure it sticks to the frosting below it. I hope that helps! :)
Hi, Im going to try your recipe someday… Your cake is awesome! I want to use metrics measurement instead of cups & after searching on the internet I found that 1cup of sugar is 200 grams different with 1cup of flour = 120grams. Is it true? And is it okay if im using cake flour? Also exchange the sour cream with yoghurt? Thank you
-imelda-
Hi Imelda. Yes, the weight of a cup of sugar does not equal the weight of a cup of flour. Yes, you can use cake flour. Use 1 cup plus 2 Tbsp of cake flour for every cup of all-purpose flour. Yes, you can exchange the sour cream with yogurt but you may get a different result. I prefer using sour cream with this recipe.
I will definitely try your recipe :) quick question I need to double it to feed +/- 30 people… Should I use bigger pans or the best choice would be doing 2 separate cakes ?
I suggest doing two cakes. maybe an 8/9 inch and a smaller 6 inch cake.