Rainbow Cake Recipe: How to Make One at Home
In this article
A rainbow cake is a tall, layered vanilla sponge cake with each layer dyed a different color of the rainbow—typically red, orange, yellow, green, blue, and purple—stacked with white or vanilla buttercream between each layer. It’s a celebration centerpiece for birthdays, pride events, or any party that calls for a dramatic reveal when sliced. The cake itself is simply a moist, tender vanilla cake; the magic comes from dividing the batter, coloring each portion, and baking them as separate thin layers. This guide walks you through the entire process, from mixing the batter to stacking a perfectly straight, colorful cake.
What You'll Need
- Three 8-inch (20 cm) round cake pans (or two, if you bake in batches)
- Parchment paper rounds for the pan bottoms
- Electric hand mixer or stand mixer
- Large mixing bowls (at least 6 small bowls for the colored batter)
- Kitchen scale (optional but helpful for dividing batter evenly)
- Gel food coloring in red, orange, yellow, green, blue, and purple
- Offset spatula for frosting
- Cake turntable (optional, makes frosting easier)
- Cooling racks
- Serrated knife for leveling layers
Step-by-Step
- Preheat and prepare pans. Preheat your oven to 350°F (175°C). Grease three 8-inch (20 cm) round cake pans with butter or nonstick spray, line the bottoms with parchment paper rounds, and lightly flour the sides.
- Make the vanilla cake batter. In a large bowl, beat 1 cup (226 g) unsalted butter and 2 cups (400 g) granulated sugar together until light and fluffy, about 3 minutes. Add 4 large eggs, one at a time, beating well after each. Mix in 1 tablespoon (15 ml) vanilla extract.
- Add dry and wet ingredients alternately. In a separate bowl, whisk together 3 cups (360 g) all-purpose flour, 1 tablespoon (12 g) baking powder, and ½ teaspoon (3 g) salt. In a measuring cup, combine 1 cup (240 ml) buttermilk and ¼ cup (60 ml) vegetable oil. With the mixer on low, add the flour mixture in three additions, alternating with the buttermilk mixture, starting and ending with flour. Mix just until combined—do not overmix.
- Divide and color the batter. Weigh the total batter (it should be about 1,600 g). Divide it equally into six bowls, about 267 g each. Add gel food coloring to each bowl: a few drops of red to one, orange to the next, then yellow, green, blue, and purple. Stir each until the color is uniform. Gel colors are concentrated; start with a small amount and add more until you reach the desired brightness.
- Bake the layers. Pour one colored batter into each prepared pan, spreading it evenly. Bake two or three pans at a time (depending on your oven size) for 12–15 minutes, until a toothpick inserted in the center comes out clean. The layers are thin, so watch them closely. Let cool in the pans for 10 minutes, then turn out onto wire racks to cool completely.
- Level the layers. Once completely cool, use a serrated knife to trim any domed tops so each layer is flat and even. This is essential for a straight, stable stack.
- Make the buttercream. While the cake cools, beat 1½ cups (340 g) unsalted butter until creamy. Gradually add 4 cups (480 g) powdered sugar, 1 cup at a time, beating on low. Add 2 teaspoons (10 ml) vanilla extract and 2–3 tablespoons (30–45 ml) heavy cream, one at a time, until the frosting is spreadable but stiff enough to hold its shape.
- Stack the layers. Place the purple layer (or any color you choose as the bottom) on a cake board or plate. Spread about ⅓ cup (80 ml) of buttercream evenly over it. Repeat with the blue, green, yellow, orange, and red layers, adding frosting between each. Press down gently as you stack to keep the cake compact.
- Crumb coat. Spread a thin layer of buttercream over the entire outside of the cake to trap crumbs. Refrigerate for 20–30 minutes until firm.
- Final frost. Apply a thicker, even layer of buttercream over the crumb coat. Use an offset spatula and a turntable for smooth sides. For a classic look, leave the top flat or create gentle swirls.
- Chill and serve. Refrigerate the finished cake for at least 1 hour before slicing to set the frosting. Use a sharp knife dipped in hot water and wiped dry between cuts for clean slices that show the rainbow interior.
Common Mistakes
- Overmixing the batter: This develops gluten and makes the cake tough and dense instead of light and tender. Mix only until the flour disappears.
- Using liquid food coloring: Liquid colors are too watery and require many drops to achieve vibrant shades, which thins the batter and alters the texture. Use gel or paste colors instead.
- Uneven layer thickness: If you eyeball the batter instead of weighing it, some layers will be thicker than others, making the cake lopsided when stacked.
- Skipping the crumb coat: Without a thin chilled layer of frosting first, crumbs will mix into your final coat, leaving brown specks in the white frosting.
- Baking all six layers at once in a crowded oven: This leads to uneven baking and collapsed centers. Bake in batches of two or three, rotating pans halfway through.
Tips
- Weigh your batter: A kitchen scale ensures each color gets exactly the same amount, so the layers bake to the same thickness and the cake stacks level.
- Use gel food coloring: Gel colors are highly pigmented, so a tiny toothpick amount goes a long way. They don’t change the batter’s consistency.
- Chill between steps: Chilling the crumb-coated cake makes the final frosting smoother and prevents the layers from sliding.
- Make it ahead: Baked and cooled layers can be wrapped in plastic wrap and frozen for up to 2 months. Thaw in the fridge overnight before assembling.
- Clean slices: Dip your knife in hot water, wipe it dry, and slice slowly. Wipe the blade between each cut for sharp, defined rainbow stripes.
Troubleshooting
- My layers are domed and uneven: Your oven may run hot, or the pans were overfilled. Trim the domes with a serrated knife, and next time reduce the bake time by a minute or two. Also, check your oven temperature with an oven thermometer.
- The colors look muted or muddy: You likely used too little gel color, or the colors bled into each other during baking. Add more gel next time, and make sure each layer is fully cooled before stacking so the buttercream stays firm.
- The cake is dry: Overbaking is the usual culprit. Since these layers are thin, they can go from perfect to dry in under a minute. Start checking at 10 minutes. Also, ensure you measured the flour correctly—spoon it into the cup and level it, don’t scoop directly.
- The cake is falling apart when stacking: The layers may be too warm or too thin. Cool them completely, and if they crack, press them back together gently and rely on the frosting to hold them. A crumb coat helps bind everything.
- My buttercream is too runny: You added too much cream. Beat in more powdered sugar, a tablespoon at a time, until it stiffens. If it’s too thick, add a few drops of cream.
- The cake slides while frosting: The buttercream between layers was too soft. Chill the assembled cake for 30 minutes before frosting the outside, and make sure your buttercream is at a cool room temperature, not warm.
Frequently Asked Questions
- Can I use a boxed cake mix? Yes. Prepare a white or vanilla boxed mix according to package directions, then follow the same steps for dividing, coloring, and baking. The texture will be slightly different but the visual result is the same.
- How far ahead can I make a rainbow cake? The baked, colored layers can be frozen for up to 2 months. A fully assembled and frosted cake keeps in the refrigerator for 3–4 days. Bring it to room temperature for 1 hour before serving for the best flavor and texture.
- Can I use natural food coloring instead of gel? Yes, but natural colors (like beet powder, turmeric, spirulina) are less vibrant and can change the flavor slightly. Expect pastel shades rather than bold rainbow colors, and you may need to add more powder, which can dry out the batter.
- Do I have to use buttermilk? No. You can substitute 1 cup (240 ml) of whole milk mixed with 1 tablespoon (15 ml) of lemon juice or white vinegar, left to sit for 5 minutes. This mimics buttermilk’s acidity and helps the cake rise.
- Why did my colors bleed into each other? This usually happens if the layers are stacked while still warm, or if the buttercream between them is too thin and liquid. Cool layers completely and use a firm buttercream. Also, avoid overmixing the color into the batter, as that can weaken the structure.
- Can I make this as a sheet cake instead? Yes. Pour all six colored batters into a single greased 9x13-inch (23x33 cm) pan, spooning them in random or striped patterns, then swirl gently with a knife. Bake at 350°F (175°C) for 25–30 minutes. This gives a tie-dye effect rather than distinct layers.