Rainbow Layer Cake
Six thin vanilla cake layers make a clear rainbow when the cake is cut: purple, blue, green, yellow, orange, and red, with narrow bands of white buttercream between them. Gel coloring gives each layer a vivid shade without adding much liquid to the batter.
You don’t need six pans. Bake the layers in batches, keeping the waiting batter refrigerated, then let every layer cool completely before stacking. Allow about 4 hours from start to finish, including cooling and a short chill for the crumb coat.
Ingredients

For the cake
- 3 cups cake flour (360g)
- 2 cups granulated sugar (400g)
- 1 cup unsalted butter, softened (2 sticks; 225g)
- 4 large eggs, at room temperature
- 1 1/2 cups whole milk, at room temperature (360g)
- 2 1/2 teaspoons baking powder
- 1/2 teaspoon fine salt
- 2 teaspoons vanilla extract
- Gel food coloring in purple, blue, green, yellow, orange, and red
For the buttercream and decoration
- 2 cups unsalted butter, softened (4 sticks; 450g)
- 7–8 cups powdered sugar (840–960g)
- 2 teaspoons vanilla extract
- 3–5 tablespoons heavy cream or whole milk, as needed
- 1–2 tablespoons rainbow sprinkles
How to Make Rainbow Layer Cake

- Prepare the pans: Heat the oven to 350°F (175°C) with a rack in the center. Lightly grease six 8-inch round cake pans and line the bottoms with parchment rounds. If using fewer pans, prepare them again before each batch.
- Mix the batter: Whisk the cake flour, baking powder, and salt together. In a large bowl, beat the butter and granulated sugar until creamy. Beat in the eggs one at a time, followed by the vanilla. Add the flour mixture in batches, alternating with the milk. Mix just until no dry flour remains; further beating can make the layers tough.
- Divide and color: Divide the batter evenly among six bowls. Tint one portion each purple, blue, green, yellow, orange, and red, adding gel coloring a little at a time.
- Bake the layers: Spread each portion evenly in a prepared pan. Bake uncovered, starting to check at 15 minutes; thin layers generally take about 15–20 minutes per batch. Refrigerate any portions waiting for the oven. If pans bake unevenly, rotate their positions once near the middle of baking if needed. A layer is done when a toothpick inserted in the center comes out clean or with a few dry crumbs, the center springs back lightly, and the edges may just begin to pull away from the pan.
- Cool and level: Let the layers cool briefly in their pans, then turn them out onto racks to cool completely. Trim any domed tops with a serrated knife only if they would make the stack uneven.
- Make the buttercream: Beat the softened butter until smooth. Gradually beat in the powdered sugar and vanilla, then add cream or milk a little at a time. The frosting should hold its shape but spread without pulling at the cake. If it becomes too soft, chill it briefly.
- Stack and crumb-coat: Place the purple layer on a cake board or serving plate. Spread a thin, even layer of buttercream over it. Continue with the blue, green, yellow, orange, and red layers, adding buttercream between each. Check that the stack is level, then spread a thin coat of buttercream over the top and sides. Chill for 20–30 minutes, until the coating is set.
- Finish: Cover the cake with the remaining white buttercream, reserving a little to pipe a small flourish. Add the rainbow sprinkles to the piped frosting. If the buttercream is soft, chill the cake briefly before slicing.
Baking with Two or Three Pans
Use identical 8-inch pans and divide the batter evenly so the layers are similar in thickness. Refrigerate the colored portions waiting for the next round, and prepare the pans again before filling them. Check every batch from 15 minutes onward rather than assuming they will all finish at the same time; batter depth, the number of pans in the oven, and oven behavior can affect the bake.
Keeping the Layers and Frosting Neat
Greased, parchment-lined pans help the thin layers release without breaking. Frost only fully cooled cake: warm layers can soften the buttercream and cause the stack to shift. Keep the filling thin and even, and chill the crumb coat before adding the final layer of white frosting so loose crumbs stay out of the finish.
Serving and Storage
Cut into 12–16 wedges with a sharp knife, wiping the blade between cuts. Set each wedge so all six colors and the white buttercream seams are visible.
Cover leftover cake. Whether it can be kept at room temperature depends on the frosting and room conditions; refrigerate it when needed, and let chilled slices soften slightly before serving. Fully cooled layers can be wrapped for later assembly. Wrapped layers, a whole cake, or individual slices can be frozen for about 2–3 months.
Nutrition
Approximate nutrition per slice, based on 14 slices: 860 calories, 5g protein, 43g fat, and 115g carbohydrates. Per 100g: about 420 calories, 3g protein, 21g fat, and 55g carbohydrates. Values vary with the amount of frosting used and whether cream or milk is added.
Equipment
- 8-inch round cake pans
- Parchment rounds
- Mixing bowls
- Electric mixer
- Whisk
- Cooling racks
- Serrated knife
- Cake board or serving plate
- Offset spatula
- Piping bag
Ingredients
For the Cake
- 3 cups cake flour (360 g)
- 2 cups granulated sugar (400 g)
- 1 cup unsalted butter, softened (2 sticks; 225 g)
- 4 large eggs, at room temperature
- 1 1/2 cups whole milk, at room temperature (360 g)
- 2 1/2 teaspoons baking powder
- 1/2 teaspoon fine salt
- 2 teaspoons vanilla extract
- Gel food coloring in purple, blue, green, yellow, orange, and red
For the Buttercream and Decoration
- 2 cups unsalted butter, softened (4 sticks; 450 g)
- 7–8 cups powdered sugar (840–960 g)
- 2 teaspoons vanilla extract
- 3–5 tablespoons heavy cream or whole milk, as needed
- 1–2 tablespoons rainbow sprinkles
Instructions
- Preheat the oven to 350°F (175°C) with a rack in the center. Lightly grease six 8-inch round cake pans and line the bottoms with parchment rounds.
- Whisk together the cake flour, baking powder, and salt.
- Beat the butter and granulated sugar until creamy. Beat in the eggs one at a time, then mix in the vanilla.
- Add the flour mixture in batches, alternating with the milk. Mix just until no dry flour remains.
- Divide the batter evenly among six bowls. Tint each portion purple, blue, green, yellow, orange, or red with gel coloring.
- Spread each portion evenly in a prepared pan. Bake for about 15–20 minutes, checking from 15 minutes, until a toothpick comes out clean or with a few dry crumbs and the center springs back lightly. Refrigerate portions waiting to be baked.
- Cool the layers briefly in their pans, then turn them out onto cooling racks and cool completely. Trim domed tops with a serrated knife if needed.
- Beat the softened butter until smooth. Gradually beat in the powdered sugar and vanilla, then add cream or milk a little at a time until the buttercream holds its shape and spreads easily.
- Place the purple layer on a cake board or serving plate. Spread a thin, even layer of buttercream over it, then stack the blue, green, yellow, orange, and red layers with buttercream between each.
- Spread a thin coat of buttercream over the top and sides of the cake. Chill for 20–30 minutes, until set.
- Cover the cake with the remaining buttercream, reserving a little to pipe a flourish. Add rainbow sprinkles to the piped frosting. Chill briefly if the buttercream is soft before slicing.
Tips
- Use identical pans and divide the batter evenly for layers of similar thickness.
- Refrigerate colored batter portions while they wait for the oven.
- Check each batch from 15 minutes onward, since baking times can vary.
- Cool the cake layers completely before frosting to prevent the buttercream from softening and the stack from shifting.
- Keep the filling thin and even, and chill the crumb coat before adding the final frosting.
