A slice of rainbow cake with one piece on a fork

Rainbow Cake

  • Author: Julianne Dell
  • Prep Time: 60 minutes
  • Cook Time: 28 minutes
  • Total Time: 1 hour 28 minutes
  • Yield: 15 slices


Bright and colorful, this Rainbow Cake is moist and fluffy, and topped with an easy vanilla buttercream frosting. Easy and fun to make, this cake is perfect for birthdays, picnics and more.


For the cake

  • 1 1/2 cups (285g) granulated sugar
  • ½ cup (118 ml) vegetable oil
  •  2 tablespoons (28g) unsalted butter, melted
  • 2 large eggs
  • 2 egg yolks
  • 1 tablespoon (15ml) vanilla extract
  • 1/2 cup (118ml) sour cream
  • 2 ½ cups (350g) all-purpose flour
  • 2 teaspoons (7.5g) baking powder
  • 1 teaspoon (4g) baking soda
  • 1 teaspoon (5g) salt
  • 1 1/3 cup (315ml) milk
  • Gel colors for dying cake batter

For the frosting

  •  2 cups (452 g) unsalted butter, cold.
  • 7 cups (911 g) powdered sugar
  • 1 tablespoon (15 ml) pure vanilla extract
  •  2-3 tablespoons (30ml) heavy whipping cream (or milk)
  • Pinch of salt (optional)
  • Gel colors for dying frosting


For the cake

  1. Preheat the oven to 350°F. Spray a 9-inch by 13-inch pan with cooking spray.
  2. In a large mixing bowl, combine the sugar, vegetable oil, butter, eggs, egg yolks and vanilla extract. Beat on medium speed until the eggs and oil are well incorporated and the batter is lighter in color, about 2 minutes. Scrape down the bowl as needed. Next mix in the sour cream and beat until well combined.
  3. In a separate bowl, combine the remaining dry ingredients. Alternate adding half the dry ingredients and half the milk at a time and mix just until the flour starts to incorporate. Then add remaining dry ingredients and milk and beat until well combined. Use a spatula to scrape down the sides of the bowl and stir the batter from the bottom to the top to ensure it’s well mixed.
  4. To dye the cake batter, divide it into 6 bowls about 3/4 cups + 2 tablespoons per bowl. Dye each of the 6 colors. See the notes section on the recipe card for specific recommendations.
  5. Spoon the batter in the pan, alternating between colors. Once finished, tap the pan on the counter a couple times to settle the batter. Bake at 350°F for 25-30 minutes. Test the cake for doneness by inserting a toothpick into the center of the cake. If the toothpick comes out clean, the cake is done. Remove from the oven and allow to cool completely.

For the frosting

  1. Cut butter into pieces. Using the paddle attachment, whip the butter for 5-7 minutes, scraping down the bowl occasionally. Beat until the butter looks light in color.
  2. Alternate adding 2 cups of powdered sugar at a time with the liquid ingredients: vanilla extract & heavy cream. Ensure the powdered sugar is well combined, then and whip for 1-2 minutes before adding more powdered sugar. Repeat until all ingredients are added.
  3. Once all the powdered sugar has been added, increase speed to medium-high and beat for another 3-5 minutes to whip additional air into the frosting.
  4. Set aside 1 cup of undyed frosting. Then divide the remaining frosting into 6 bowls, about ½ cup each. Dye each of the 6 colors and then place each color into its own piping bag. See the notes section on the recipe card for specific recommendations.

To decorate

  1. To fill a multicolored bag, place a piping bag in a pint glass, folding the bag over the top edge. Pipe a line of each color (except white) into the bag. Fill 2/3 full and shake the bag to allow the colors to settle. Make 2-3 bags until you run out of frosting. Cut off the end of the bag, and then drop it into a second piping bag fitted with the piping tip.
  2. Start with the white, piping large rosettes with a 1M and/or Ateco 866 piping tip. Reserve some of the white to fill in later.
  3. Next pipe rainbow rosettes with a 1M and/or Ateco 866 piping tip. Then start adding in smaller rosettes using Tip 21 and Tip 199. Fill in remaining large areas with a ribbon using petal tip 104, with the skinny end facing up.
  4. Continue to fill in the holes with remaining white and rainbow frosting using any variety of these tips until the cake is frosted.


  • I used the Wilton Color Right system to dye the cake and frosting.

Dying the cake batter

  • To make the red, orange, and yellow colors, add 3 drops of gel color
  • To make the green, use 3 drops blue 2 drops yellow
  • To make the blue, use 5 drops of gel color
  • To make the purple use 4 drops pink 1 drop blue.

Dying the frosting

  • To make the red, orange and yellow colors, use 3 drops of gel coloring
  • To make the green, use 2 drops blue 2 drops yellow
  • To make the blue, use 5 drops of gel color
  • To make the purple, 2 drops pink 1 drop blue

 Piping tips used

Nutrition Information:
1 slice
  • Category: Cake
  • Method: Baking
  • Cuisine: American