Rainbow Cake
Rainbow Cake is a six-layer celebration cake with a soft, tender crumb and a different bright color in every slice. The layers bake in batches, then stack with vanilla buttercream between them and over the outside.
Plan for 60 minutes of prep and 40 minutes of baking; the cake serves 12. It makes a cheerful centerpiece for birthdays, school celebrations, and other gatherings where a colorful slice is part of the fun.
Why you’ll love it
Why This Rainbow Cake Recipe Works
The method keeps the colorful layers tender and makes a tall cake easier to assemble neatly.
- Oil keeps the crumb tender. Vegetable oil stays fluid after cooling, which helps the cake layers remain soft. It also makes the batter easy to whisk together.
- The batter is divided before coloring. Portioning the mixed batter into six bowls makes it easier to tint each color evenly without overworking the whole mixture.
- Buttercream provides structure. A thick layer of frosting between each cake gives the stack grip and adds a creamy contrast to the soft crumb.
- A long chill helps the stack hold. Refrigerating the assembled cake firms the buttercream. That makes the tall layers less likely to slide when you cut and serve it.
What you need
Ingredients You’ll Need

Measure the flour carefully and bring the eggs, milk, butter, and cream to room temperature as directed. The food coloring creates six shades from the listed colors.
- All-purpose flour: Five cups (600g). Weigh it for the most accurate result, or spoon it lightly into measuring cups and level.
- Granulated sugar: Three cups (600g), to sweeten and soften the cake layers.
- Baking powder: One tablespoon supplies most of the lift for the layers.
- Baking soda: Half a teaspoon works alongside the baking powder to help the cake rise.
- Salt: One teaspoon for the cake batter, plus half a teaspoon for the buttercream.
- Large eggs: Six, brought to room temperature so they blend smoothly with the other wet ingredients.
- Vegetable oil: One and a half cups (360ml) keeps the cake moist and tender.
- Whole milk: One and a half cups (360ml), at room temperature, adds moisture and helps make a pourable batter.
- Vanilla extract: One tablespoon for the cake and two teaspoons for the buttercream; use pure or imitation vanilla.
- Food coloring: Red, yellow, blue, and green coloring are used to make red, orange, yellow, green, blue, and purple batter.
- Unsalted butter: Two and a half cups (565g), softened to room temperature for a smooth, fluffy frosting.
- Confectioners’ sugar: Ten cups (1200g) form the body of the buttercream; add it gradually to avoid a cloud of sugar.
- Cream: Half a cup (120ml), at room temperature, loosens the frosting as needed while mixing.
Tools
Equipment You’ll Need
- Two or three 8-inch round cake pans: The pans are used in batches to bake the six colored layers; parchment helps release each one cleanly.
- Six mixing bowls: Use these to divide and color the batter, keeping each shade separate while the layers bake.
- Whisk and large mixing bowls: A whisk combines the cake batter, while roomy bowls make mixing the dry and wet ingredients easier.
- Stand mixer or hand mixer: A mixer beats the buttercream until fluffy and helps incorporate the large amount of confectioners’ sugar.
- Wire cooling rack: The rack lets the baked layers cool fully before you spread on the buttercream.
The method
How to Make Rainbow Cake
1. Prepare the pans
Heat the oven to 350°F. Grease two or three 8-inch round cake pans with baking spray or butter, then cover the bottoms with parchment.
Set out the six bowls for coloring the batter so they are ready when mixing is done.
2. Combine the dry ingredients
In a large bowl, whisk the flour, sugar, baking powder, baking soda, and salt until evenly distributed.
Break up any flour or sugar lumps now so they do not carry through into the finished layers.
3. Mix the wet ingredients
In another large bowl, whisk together the eggs, vegetable oil, milk, and vanilla. Pour this mixture into the dry ingredients and whisk just until combined.
Stop once you no longer see dry pockets. Excess mixing can develop the gluten and make the cake dense or tough.
4. Color the batter
Divide the batter among six mixing bowls. Tint them red, orange, yellow, green, blue, and purple, using the red, yellow, blue, and green food coloring.
Add color gradually and stir gently until each bowl is even. Refrigerate the bowls that are waiting to bake.
5. Bake the first layers
Pour one color of batter into each prepared pan. Bake for 20 minutes, or until a toothpick inserted into the center comes out clean.
The surface should look set, and the toothpick should not carry wet batter when you test the middle.
6. Cool and bake the rest
Let the cakes sit in their pans for 10 minutes, then turn them out and cool completely on a wire rack. Wash the pans, grease and line them again, and bake the remaining batter.
Do not frost warm layers; heat can soften the buttercream and make the stack unstable.
7. Make the buttercream
Using a large bowl or a stand mixer with the whisk attachment, whip the butter and salt on medium until very pale and airy, about 5 minutes. On low, gradually mix in the confectioners’ sugar, adding a tablespoon of cream at a time and scraping the bowl occasionally.
Once all the sugar is incorporated, mix in the vanilla. If the frosting feels grainy when rubbed between your fingers, add more cream; then beat on medium-low until light and fluffy, about 1 minute.
8. Stack and chill the cake
Remove the parchment. Set the purple layer on a cake plate and spread ½ cup of frosting over it. Add the blue layer and another ½ cup of frosting, then repeat with green, yellow, orange, and red. Cover the outside with the remaining frosting and chill for at least 1 hour before serving.
If the layers are domed, trim the tops with a serrated knife before stacking so the cake sits level.
Doneness
How to Tell When It’s Done
The layers are ready when their tops look set and a toothpick inserted in the center comes out clean. If it carries wet batter, return the pan to the oven and check again; avoid relying on color alone, since the dyed batter can make visual cues harder to judge.
Cool the layers fully before assembly. They should feel cool rather than warm when you touch the center; warm cake can melt the frosting and cause the stacked layers to shift.
Tips & common mistakes
Tips and Common Mistakes
A few small details help keep the layers tender and the finished cake straight.
- Mix only until combined. Once the wet and dry mixtures meet, stop when no dry patches remain. Too much mixing can leave the crumb tough and dense.
- Keep waiting batter cold. The bowls that are not in the oven should stay in the fridge. This helps slow the baking powder reaction while the earlier colors bake.
- Cool each layer completely. Buttercream spreads cleanly on cool cake. Frosting a warm layer can make the filling run and weaken the stack.
- Start with room-temperature butter. Cold butter can stay lumpy instead of whipping smoothly. Let it soften before beginning the buttercream.
- Trim domed tops if needed. Use a serrated knife to level any rounded tops before stacking. Cake strips can also help layers rise more evenly from edge to center.
Make it your way
Substitutions and Variations
Keep the main proportions intact, but adjust the colors and flavorings to suit the celebration.
- Color combinations: The listed colors create the six rainbow shades. If you prefer fewer colors, divide the batter into fewer bowls and make fewer layers.
- Vanilla variation: Almond extract can replace some of the vanilla for a different bakery-style flavor, but it is stronger, so use it sparingly.
- Dairy-free milk: An unsweetened plant milk can replace whole milk, though the cake’s richness and flavor may shift slightly.
- Different frosting: A stable cream cheese frosting can be used between the layers, but it will taste tangier and may need extra chilling to support the stack.
- Cake strips: Use damp cake strips around the pans if you have them. They help the layers rise more evenly and reduce domed tops.
Serving
What to Serve with Rainbow Cake
Serve slices chilled or let the cake sit briefly at room temperature so the buttercream softens. A small scoop of vanilla ice cream or a bowl of fresh berries makes a simple accompaniment.
For a birthday table, pair it with coffee, tea, or cold milk. Cut slim slices; the six cake layers and generous frosting make each piece substantial.
Storage
Make-Ahead, Storage and Reheating
Make ahead: Bake the layers ahead, let them cool completely, and wrap them well before storing. Make the buttercream and assemble the cake when convenient; allow at least 1 hour for the finished cake to chill before serving.
Storage: Keep leftover cake covered at room temperature for up to 3 days, as directed. If your kitchen is warm, refrigerate it in an airtight cake container so the buttercream stays firm.
Freezing: Freeze unfrosted layers tightly wrapped, or freeze individual frosted slices in an airtight container. Thaw in the refrigerator; the buttercream may soften slightly after thawing.
Reheating: Do not reheat the cake. If it has been refrigerated, let a slice stand briefly before serving so the buttercream is easier to cut and the crumb is not too firm.
Questions
Rainbow Cake FAQs
Can I bake the layers in batches with only two pans?
Yes. Bake the colors that fit, then wash, grease, and line the pans again for the remaining batter. Keep the waiting bowls refrigerated between batches.
Can I make this cake with three cake pans?
Yes. The method allows two or three 8-inch pans, so three pans let you bake more colors at once while the remaining batter waits in the refrigerator.
How do I get orange and purple from the listed colors?
Use red and yellow together for orange, and red and blue together for purple. Add the colors gradually until each bowl reaches the shade you want.
Why is my buttercream grainy?
It may need more cream to smooth it out. Add additional cream as directed, then beat the frosting on medium-low until it becomes light and fluffy.
Can I level the cake layers after they cool?
Yes. If a layer has a domed top, use a serrated knife to remove the raised part so the layers stack evenly.
How should I cut neat slices through all six layers?
Use a long, sharp knife and wipe the blade between cuts. Chilling the cake first firms the buttercream and helps the colored layers stay in place.
Recipe Card

Rainbow Cake
Ingredients
Method
- [For the Rainbow Cake Layers:] Preheat the oven to 350F. Grease two or three 8-inch round cake pans with baking spray or butter. Line the bottoms with parchment paper.
- [For the Rainbow Cake Layers:] In a large mixing bowl, whisk together the flour, sugar, baking powder, baking soda, and salt.
- [For the Rainbow Cake Layers:] In another large mixing bowl, combine the eggs, vegetable oil, milk, and vanilla. Whisk until well combined. Pour into the flour mixture and whisk until combined.
- [For the Rainbow Cake Layers:] Divide the batter among 6 mixing bowls. Color each batter with food coloring to make red, orange, yellow, green, blue, and purple batters. Pour a single color batter into each cake pan. Place the remaining batter bowls in the fridge until ready to bake. (This helps to stop the baking powder from reacting while waiting to bake.)
- [For the Rainbow Cake Layers:] Bake for 20 minutes or until a toothpick inserted into the center comes out clean. Let the cakes cool for 10 minutes in the pan, then remove and finish cooling on a wire rack. Wash the pans, grease and line with parchment paper again, and bake the remaining batters.
- [For the Buttercream:] In a large mixing bowl or the bowl of a stand mixer fitted with the whisk attachment, beat the butter and salt on medium speed until very fluffy and pale, about 5 minutes.
- [For the Buttercream:] With the mixer on low speed, gradually add the confectioners’ sugar a cup at a time, adding a tablespoon of cream at a time throughout mixing. Stop and scrape down the bowl occasionally during mixing. Once all of the sugar is added, beat in the vanilla and add additional cream if the frosting feels grainy when rubbed between your fingers. Increase the speed to medium-low and beat until light and fluffy, about 1 minute.
- [For the Assembly:] Remove the parchment paper from the cake layers. Place the purple layer on a cake plate and spread ½ cup of frosting over the top. Place the blue layer on top and spread another ½ cup of frosting on top. Repeat with the remaining cake layers in the order of green, yellow, orange, and red. Spread the remaining frosting all over the outside of the cake. Chill the cake for at least 1 hour before serving. Leftover cake should be covered and can be stored at room temperature for up to 3 days.