Skip to Content

How to Make Rainbow Cake Layers

If you want to learn how to make rainbow cake layers from scratch, you’ve come to the right place! Rainbow cakes can seem a bit intimidating, but they don’t have to be.

With the help of a bit of food coloring you can make vibrant and beautiful cake layers that are sure to wow a crowd.

image of rainbow cake layers stacked with american buttercream

Coloring These Rainbow Cake Layers

I used gel food coloring to color these rainbow cake layers. Liquid food coloring can work too, but you won’t be able to get the same vibrant colors.

You also can throw off the consistency of the cake batter if you add too much liquid food coloring.

image of rainbow cake layers ready to be baked

highly recommend using gel food coloring. Gel food coloring is incredibly concentrated, so it allows you to use less. A couple drops will create beautiful, bright colors.

Gel food coloring is also thicker, and won’t change the consistency of the cake batter. Americolor gel food coloring is my favorite brand and I order bottles of it on amazon.

Natural food coloring (either liquid or powder) can be used in place of the gel food coloring to make this cake too. The colors won’t be quite as vibrant, but it will still be beautiful.

Substitutions and Swaps – Rainbow Cake Layers

If you have food allergies or restrictions, I’ve got you covered!

Below are some swaps and substitutions that can be made in this rainbow cake recipe:

  • All Purpose Flour – This recipe turns out best with AP flour, but you can use a gluten free flour blend or cake flour if needed.
  • Granulated Sugar – I do not recommend reducing the amount of sugar or changing the type of sugar. It will change the texture of the cake layers.
  • Baking Powder – If you only have baking soda on hand use 3/4 tsp of baking soda (it’s much more potent than baking soda) and add a teaspoon of white or apple cider vinegar to activate it.
  • Unsalted Butter – If you only have salted butter on hand you can use it in place of the unsalted butter. Just be sure to omit the salt that this frosting recipe calls for. You can also use vegan butter in its place!
  • Egg whites – If you don’t have egg whites on hand (I use the type out of the carton), you can use 4 whole eggs in place of the egg whites. Or you have an egg allergy you can use flaxseed eggs in their place or 1 cup of unsweetened applesauce.
  • Buttermilk – You can also use full fat yogurt, sour cream, whole milk, or an alternative yogurt or milk (almond, soy, oat) if you’re dairy free.
  • Vegetable Oil – You can use any flavorless oil in this recipe. Canola or even sunflower oil would work great!
  • Gel food coloring – Natural food coloring (either liquid or powder) can be used in place of the gel food coloring to make this cake! The colors won’t be quite as vibrant, but it will still be beautiful.
image of 8 color inclusive rainbow cake layers stacked and ready to be crumb coated for pride

Substitutions and Swaps – Vanilla Buttercream Frosting

  • Unsalted Butter – If you only have salted butter on hand you can use it in place of the unsalted butter. Just be sure to omit the salt that this frosting recipe calls for. You can also use vegan butter in its place!
  • Heavy Cream – Whole milk or alternative milk (soy, almond, oat) will work fine in this frosting recipe too.
  • Vanilla Extract – Other extracts can also be used in place of the vanilla extract like coconuthazelnut or almond extract.

Stacking These Cake Layers in Color Order

Once your cake layers are baked and cooled, you want to make sure they’re stacked following the color order.

ROYGBV is a simple way to remember the color order of red, orange, yellow, green, blue and violet. I decided to start with my violet / purple cake layer on the bottom of my cake. You can also start with red if you prefer though!

You’ll probably notice that I also included a brown and black layer to make this an inclusive rainbow for Pride! However, you can totally just stick with the six classic colors of the rainbow when you’re making you cake layers.

Tips for Making The Best Rainbow Cake Layers:

  • Make your own buttermilk if you don’t any! Add 1 Tbsp of lemon juice or vinegar to 1 cup of whole milk for each cup of buttermilk that you need.
  • Be sure to properly measure your flour (spoon into the cup measure then level) or use a kitchen scale to measure your dry ingredients.
  • Ingredients at room temp mix together better, so be sure you set out any cold ingredients ahead of time.
  • Mix your cake batter just until the ingredients are incorporated. This will ensure your cake layers are tender and fluffy.
  • Chill your cake layers in the freezer for about 20 minutes before assembling the cake. This will make the cake way easier to stack and frost. This cake has 8 layers and it’s much easier to stack if the cake layers are cold to the touch.
  • One batch of batter can be also be used to make two 9×13? sheet cake. Bake them at 325F for 33-38 minutes. You can marble the cake batter together to make swirly rainbow cake layers like this.
  • Make these rainbow cake layers vegan or dairy free! Use your favorite type of dairy free milk to replace the buttermilk, flax seed eggs and vegan butter sticks in place of the butter in the cake and frosting.
image of pride cake being painted rainbow colors with edible paint made from vodka and gel food coloring.

Making These Rainbow Cake Layers In Advance & Storage Tips:

  • Make your cake layers in advance and freeze them. It breaks the process up and make it more approachable.
  • Make your frosting ahead of time too or save any leftover frosting! It can be stored in an airtight container in the fridge for up to a month. Or store it in the freezer for up to 3 months. Be sure to give it a good stir once it thaws to get the consistency nice and smooth again.
  • frosted cake can last in the fridge for a week or in the freezer for up to a month. The buttercream locks in all the moisture, keeping the cake fresh and delicious!
  • If you cut into the cake and have leftovers, use remaining frosting to cover the cut section. This will keep it moist and store in the fridge for up to a week.

Let Me Know What You Think!

If you try this recipe for rainbow cake layers, I’d love to hear what think of it! Please leave a rating, and let me know your thoughts by sharing a comment.

Tag me @chelsweets and use the #chelsweets so that I can see your amazing creations on social media.

image of rainbow pride cake cut open to show 8 rainbow layers

Other Recipes You Might Like:

Yield: 24

How to Make Rainbow Cake Layers

image of rainbow pride cake made based on the updated LGBTQ flag with 8 colors

This colorful rainbow cake is an amazing way celebrate any occasion! It's made with 8 rainbow cake layers and a fluffy vanilla buttercream.

Prep Time 15 minutes
Cook Time 20 minutes
Additional Time 1 hour
Total Time 1 hour 35 minutes


Rainbow Cake Layers

  • 3 cups all-purpose flour (390 grams)
  • 3 cups granulated sugar (600 grams)
  • 2 1/2 tsp baking powder (10 grams)
  • 1 tsp salt (6 grams)
  • 1 cup unsalted butter, room temperature (226 grams) - 2 sticks
  • 1 cup pasteurized egg whites from a carton (or about 7 egg whites) (235 grams)
  • 1 1/2 cups buttermilk, room temperature (345 grams)
  • 2 Tbsp vegetable oil (28 grams)
  • 2 tsp vanilla extract (8 grams)
  • purple, blue, green, yellow, orange, red, brown, and black gel food coloring (if desired)

Vanilla Buttercream Frosting

  • 3 cups unsalted butter, room temperature (678 grams)
  • 1 Tbsp vanilla extract or vanilla bean paste (12 grams)
  • 1 tsp salt (6 grams)
  • 11 cups powdered sugar (1375 grams)
  • 1/2 cup heavy cream (or whipping cream) (120 grams)

Optional Decorations


Rainbow Cake Layers:

  1. Preheat oven to 325°F. Line eight, 6-inch or 7-inch pans with parchment rounds, and grease with a light spray of non-stick cooking spray.
  2. Mix together 3 cups all purpose flour, 3 cups sugar, 2 1/2 tsp baking powder and 1 tsp salt in a stand mixer with a paddle attachment or hand mixer until fully combined.
  3. Mix in 1 cup of unsalted butter slowly into the dry ingredients on a low speed. Continue to mix until no large chunks of butter remain and the mixture looks crumbly.
  4. Pour in 1 cup of egg whites and mix on low until just incorporated. Mix in 1 1/2 cups buttermilk in two installments, on a low speed.
  5. Add in 2 tsp of vanilla extract and 2 Tbsp of vegetable oil, and mix at a low speed until fully incorporated.
  6. Scrape down the sides of the bowl with a rubber spatula, then beat on a low speed for about 30 seconds to make sure everything is properly mixed together.
  7. Divide the batter evenly between 8 bowls. I like to use a digital scale to make sure each bowl has the same amount of batter, so that each cake layer is the same height.
  8. Color each bowl a different color using purple, blue, green, yellow, orange, red, brown, and black gel food coloring. You can also use 1 tsp baking cocoa and 1 tsp black cocoa to naturally color the brown and black cake layers.
  9. Bake for 18-21 minutes, or until a toothpick comes out with a few moist crumbs.
  10. I couldn't fit all 8 pans in my oven at once, so I baked the cake layers in two batches. It's fine to let the batter sit out at some of the cake layers bake! Just cover the bowls or pans with a kitchen towel as they sit.
  11. Allow the pans to cool for 10 minutes, then run a small offset spatula around perimeter of the pan to separate the cake from the pan.
  12. Place cake layers into the freezer for 15 minutes to accelerate the cooling process. Once the layers are fully cooled, carefully flip the pans and remove the layers.
  13. If you make these cake layers in advance and freeze them, let them thaw for about 10 minutes before making your cake. The cake layers should still be slightly cold to the touch, which will make it easier to assemble your cake.

Fluffy Vanilla Buttercream Frosting:

  1. While the cake layers bake and cool, make the vanilla buttercream frosting.
  2. Beat 3 cups of unsalted butter on a high speed for 3 minutes with a whisk attachment. It should become lighter in color and increase in volume as air is incorporated into the butter.
  3. Mix in 1 Tbsp of vanilla extract or vanilla bean paste and 1 tsp salt on a medium speed.
  4. Slowly add in 11 cups of powdered sugar, 1 cup at a time. Alternate with small splashes of 1/2 cup of heavy cream or milk.
  5. Continue to mix on low speed for a few minutes, until the desired consistency is reached. 
  6. If the frosting is too thick, add in additional cream (1 TBSP at a time). If the frosting is too thin, add in more powdered sugar (quarter of a cup at a time).

To Assemble This Rainbow Cake:

  1. Stack and frost the rainbow cake layers on a greaseproof cake board, using a dab of frosting to help stick the first cake layer to the board. Start with the purple cake layer.
  2. Spread an even layer of fluffy vanilla buttercream between each cake layer.
  3. Repeat and stack the cake layers in color order: purple, blue, green, yellow, orange, red, brown, black.
  4. Cover the cake in a thin coat of frosting, being sure you fully cover the cake layers. Smooth using a bench scraper, then chill the cake in the fridge (10 minutes) or freezer (5 minutes) until the frosting is firm to the touch.
  5. Add a second, thicker layer of frosting to the cake, and smooth using a bench scraper. Place the cake in the freezer to chill for 10-15 minutes, or in the fridge for 30 minutes.
  6. In a plastic paint palette, combine a couple drops of each color of gel food coloring with 1/2 tsp of vodka or clear extract to create edible paint.
  7. Use a clean, thick paintbrush to paint the food coloring mixture up the the sides of the cake.


One batch of cake batter makes about 1800 grams, so when I'm making a cake with 8 layers I add 225 grams of batter into each pan.

These cake layers can be made in advance!! Learn more about how far in advance they can be made, and how to properly wrap them in my post on how to make cake layers ahead of time.

Since this frosting will be used to decorated a cake, it is important to mix the buttercream on the lowest speed at the end of the process for a couple minutes, to get out any extra air that might have be incorporated during the mixing process.

You can also stir the frosting in a bowl with a rubber spatula, pushing it from side to side, to get rid of any air bubbles. This will make it easier to get super smooth sides on your cake!

Nutrition Information



Serving Size


Amount Per Serving Calories 660Total Fat 33gSaturated Fat 20gTrans Fat 0gUnsaturated Fat 11gCholesterol 86mgSodium 297mgCarbohydrates 89gFiber 1gSugar 75gProtein 4g


Thursday 7th of July 2022

Chels- are there any more of these lovely rainbow recipes? It’s PERFECT for Pride month.

Deanna Lombardi

Thursday 7th of July 2022

Hi Chels, The cake looks delish. Can I use something like cream cheese frosting instead for the frosting? Or will it not work then?


Tuesday 12th of July 2022

Hi Deanna,

Great question! This cake would taste amazing with cream cheese frosting, but make sure it's a thick cream cheese frosting! It needs to have a consistency similar to buttercream to be able to support all those rainbow layers. I'd recommend using my cream cheese buttercream, it's delicious and thick enough for layer cakes like this. Here's the link:

Hope that helps, happy baking!


Thursday 7th of July 2022

Hi Chels, I absolutely loved this cake, it’s perfect for Pride Month. I’m wondering if halving the recipe would make the cake half the height or just tinier in both dimensions.


Tuesday 12th of July 2022

Hi Amanda!

These layers are already pretty thin, so I'm not sure halving it would work! If you did, the layers would bake super fast and the cake would be half the height. If you want to make a smaller rainbow cake, I'd recommend using 6-inch pans and cutting the recipe in half. Hope that helps, happy baking!

Mary C Howicz

Wednesday 6th of July 2022

Hi Chels, What would you recommend for making two of these cakes? Should I do the recipe twice or double my ingredients and then half it before I make the cake layers and do that stuff?


Tuesday 12th of July 2022

If you have a big enough mixer you can double the recipe, but it's a pretty tight squeeze in anything smaller than an 8 qt stand mixer! It might be easiest to make the recipe twice. However, you can do half the colors in one batch (and bake two layers of each color), and half in the other batch to minimize dishes!!

Elissa Cartier

Wednesday 6th of July 2022

Hi Chels, I need to make it like, half the size, but I’m really bad at halving stuff without a calculator (I lost mine). What should I do?

Skip to Recipe