This post may contain affiliate links. For more information, read my disclosure policy.

Learn how to make a Rainbow Cake with colorful layers and buttercream frosting! This fun cake is perfect for birthdays, rainbow-themed parties, St. Patrick’s Day, or PRIDE. I’m showing you step-by-step how to make a rainbow layer cake that will wow your friends and family!

cut open rainbow cake on white cake plate

Best Rainbow Cake – it really is easy!

Can I tell you how much I love this rainbow cake recipe? It’s one of my favorite cakes to make because it looks just like a regular layer cake from the outside, but when you slice it, you get all of those colorful rainbow layers.

Making a rainbow cake is not hard – it just takes time! Trust me, this cake has a wow factor and is super fun to serve for parties. I mean, how can you not smile just looking at it? It’s so cute!

We are using white cake mix for this cake – it makes it so much easier than trying to make cake batter from scratch. But we are doctoring it up with some extra ingredients, so the cake tastes homemade and also is sturdier.

ingredients in rainbow cake

Ingredients in Rainbow Cake

  • White cake mix – for this recipe, you will need two boxes.
  • All-purpose flour – adding extra flour gives the cake more structure, so the layers are sturdy.
  • Large egg whites – and only egg whites! If you use egg yolks, they will muddle the cake colors, so separate the eggs before you start making the batter. Save the yolks for some scrambled eggs!
  • Milk – you can use 2% or whole milk or even nondairy.
  • Sour cream – leave it out, so it warms to room temperature. This makes it a lot easier to mix with the other ingredients.
  • Food coloring – red, orange, yellow, green, blue, and purple. Gel food coloring will give you brighter colors.
  • Vanilla buttercream frosting – you will need two batches.

Click to see the recipe card below for full ingredients & instructions!

How to Doctor a Cake Mix

There are different ways to doctor cake mix, and for this rainbow layer cake, I like to add extra flour, some sour cream, and use milk instead of water.

The flour gives the cake more structure, so it holds up well. The sour cream and milk make it taste more like a homemade cake.

So you can go ahead and disregard the instructions on the cake mix – we’re making a few changes, so the cake is even better!

slice of rainbow cake on white plate

What Cake Pans to Use 

For this rainbow cake, you will need 8” cake pans. They should be the same kind of cake pan made by the same brand – I don’t recommend using cake pans from different brands, they should all be the same.

You can make the whole recipe and use six 8” cake pans. If you only have three pans, that’s okay, too. You can make half the recipe with three pans and then make it again. More details about that are in the recipe card!

How to Make Rainbow Cake

  1. Grease and flour 8” cake pans or coat them with baking spray with flour.
  2. Mix the cake mix, flour, egg whites, milk, sour cream, and oil with an electric mixer in a large bowl.
  3. Divide the batter equally among six bowls.
  4. Tint each batter a different color and stir well to combine,
  5. Pour each colored batter into its own cake pan.
  6. Bake the cakes at 350°F for 15 to 20 minutes. Cool the cakes in the pans before removing them.
  7. Once they are cooled, remove the cakes from the pans and peel off the parchment paper. If needed, level the cakes with a serrated knife.
  8. Place the purple cake on a cake plate. Spread the frosting over the top and then top it with the blue cake. Top it with frosting and repeat this process with the green, yellow, orange, and red cake layers.
  9. Frost the sides and top of the layer cake with a crumb coating which is just a thin layer of frosting. Refrigerate the cake until the frosting is set.
  10. Frost the cake with a second layer of frosting and then decorate it with sprinkles.

How to Decorate Rainbow Cake

You can frost your cake with vanilla buttercream frosting or try marshmallow buttercream or cream cheese buttercream frosting or stable whipped cream frosting.

You can also use canned frosting – you will need four to five cans for this cake.

Add some sprinkles to give your cake a finishing touch.

sliced rainbow cake

Tip From Dorothy

Expert Tips

  • Batter: To ensure you divide the batter evenly among the cake pans, use a kitchen scale to measure the weight.
  • Food Coloring: Gel food coloring is the best for this recipe. The colors are really vibrant!
  • Cake Pans: Use the same kind of pans made by the same brand. Depending on the brand, the actual size may vary, so don’t use a mix of cake pans from different brands. Your cakes will be uneven and won’t stack well if you do.

Make Ahead Instructions

Make and bake the cake layers as instructed. Allow them to cool, and then wrap them individually in several layers of plastic wrap. Store them in the freezer for up to a month.

How to Store Rainbow Cake

Once you’ve assembled the rainbow layer cake, you can cover it and keep it in the refrigerator for three days. You can also make the frosting and freeze it in an airtight container for up to a month.

slice of rainbow cake on white plate


What do I do if I only have 3 pans?

You can make the cake in two batches if you only have three cake pans. Mix one cake mix with ½ cup flour, 5 egg whites, ¾ cup milk, ½ cup sour cream, and ½ cup vegetable oil. Divide the batter into three bowls and use one color for each. Bake the cakes as instructed. Once the cakes are cool, remove them from the pans and use the same pans to make the other three layers using the rest of the colors.

How do I keep cake layers from doming?

Cakes dome on top because the edges of the cake bake faster than the middle causing the top to dome up as it bakes. Luckily, there are a couple of solutions! To stop your cakes from doming, use bake even strips. These fabric strips insulate the cake pan sides, so your batter cooks evenly. If you don’t have the strips, wait for it to completely cool. Once cooled, use a serrated knife to slice off the dome to create a flat surface on the top of your cake. Do this carefully, so you slice evenly.

How to make a cake from leaning?

Use cake pans made by one brand. Different cake pan brands vary in size, so if you use a mix of different pans, your layers may not be even and will cause your cake to lean. Divide the batter evenly among your cake pans. The easiest way to do this is to measure the weight of the batter on a scale for each cake layer. If your layers are different sizes, your cake may end up leaning.

How do I make a rainbow cake be vibrant colors?

For the brightest, most vibrant cake colors, use gel food coloring. I like Wilton or Americolor brands.

sliced rainbow cake

Rainbow Cake Recipe

5 from 16 votes
Semi-Homemade Rainbow Cake is sturdy enough to stack 6 layers and the perfect vibrant rainbow cake for a fun party!
Prep Time 2 hours
Cook Time 30 minutes
Total Time 2 hours 30 minutes
Yield 16 servings
Serving Size 1 serving


  • 2 15.25 ounce packages white cake mix
  • 1 cup (124g) all-purpose flour
  • 10 large egg whites
  • 1 ½ cups (345ml) milk (full fat is best but any can be used)
  • 1 cup (245g) sour cream room temperature
  • 1 cup (237ml) vegetable oil
  • Food Coloring red, orange, yellow, green, blue, purple
  • 2 recipes Vanilla Buttercream Frosting
Save this recipe!
Get this sent to your inbox, plus get new recipes from us every week!


  • Preheat oven to 350°F. Prepare six 8-inch round cake pans: grease and flour them (or spray with nonstick baking spray with flour) and line the bottom with parchment paper. *See note for how to do this in 2 batches if you don’t have 6 pans*
  • Add cake mix, flour, egg whites, milk, sour cream, and oil to a large bowl. Mix on medium speed with a hand mixer until smooth.
  • Divide cake batter evenly into 6 bowls. (If you have a kitchen scale, you can make sure they are even by weighing the batter in each bowl as you divide it.)
  • Color each bowl a different color (one color per bowl). Stir to distribute color throughout, being sure to scrape the bottom of the bowl.
  • Pour batter in each pan (one per color).
  • Bake cake 15-20 minutes, or until a toothpick comes out clean. Cool completely before removing from pans.
  • Remove the cakes from the pans and remove parchment paper. If needed, level the cakes with a serrated knife.
  • Place purple cake layer on cake plate. Top with frosting, then add the blue layer, then green, then yellow, orange and red, making sure to frost in between each.
  • Frost the outside of the cake with a thin crumb coat of frosting. Chill cake until frosting is set to the touch then do a second layer of frosting. Decorate with sprinkles as desired.
  • Store cake covered in refrigerator for up to 3 days.
  • Make ahead: you can make the cake layers and frosting and freeze them separately for up to one month. Be sure to wrap layers well in plastic wrap and freeze frosting in an airtight container.

Recipe Video

Recipe Notes

  • It’s important to bake these in six of the SAME pans (not different brands). Different cake pans might be slightly different and it won’t stack as well.
  • If you are buying pans, buy 3. Then make the recipe in 2 batches as follows: Mix 1 cake mix with ½ cup flour, 5 egg whites, ¾ cup milk, ½ cup sour cream, ½ cup vegetable oil. Color with 3 different colors and bake as directed. Once cool, remove from pans and repeat with remaining colors.
  • This cake is tall so it’s important your layers are flat. If they dome in the oven be sure and level them. I recommend using bake even strips to help the cakes from doming.
  • You can use canned frosting if you want, but you’ll need about 4-5 cans.
  • This would also be fantastic with Marshmallow Buttercream or Cream Cheese Frosting.
  • For the most vibrant colors, use GEL food coloring. I recommend Americolor or Wilton.

Recipe Nutrition

Serving: 1serving | Calories: 202kcal | Carbohydrates: 8g | Protein: 4g | Fat: 17g | Saturated Fat: 4g | Polyunsaturated Fat: 8g | Monounsaturated Fat: 4g | Trans Fat: 1g | Cholesterol: 11mg | Sodium: 46mg | Potassium: 91mg | Fiber: 1g | Sugar: 2g | Vitamin A: 127IU | Vitamin C: 1mg | Calcium: 45mg | Iron: 1mg
Nutritional information not guaranteed to be accurate
Course Dessert
Cuisine American

The perfect Rainbow Cake recipe starts with a cake mix and has homemade frosting. No one will know this cake is semi-homemade and it’s the perfect rainbow colors for any rainbow party!

Favorite Rainbow Recipes

Dorothy Kern

Welcome to Crazy for Crust, where I share recipes that are sometimes crazy, often with a crust, and always served with a slice of life.

5 from 16 votes (8 ratings without comment)

Leave a Comment

Your email address will not be published. Required fields are marked *

Recipe Rating


    1. No you can! Just make sure they’re not rounded – be sure to cut off any rounded part – so the layers are flat.