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

Learn how to make Rainbow Frosting in a swirl pattern for cupcakes, cakes, and cookies! I’m sharing all of my secrets for the best rainbow frosting – it’s so pretty and easy to make. I can’t get over how pretty this is – and it tastes SO MUCH BETTER than store bought frosting!

vanilla cupcakes with rainbow colored frosting on top.

Rainbow Frosting Cupcakes

One of my favorite frosting techniques is rainbow swirl frosting, and I think you’ll be surprised how easy it is to do. Next to sprinkles, swirl frosting is one of my favorite ways to decorate birthday cakes, rainbow cupcakes, and cookies. You can use any colors you want to dye frosting – I’ve used this same method to make Unicorn Cupcakes!

Make my rainbow cake with this colorful frosting and you’ve got an explosion of rainbows for any party. You can use my homemade American buttercream recipe or even cream cheese frosting for this (or use a can of frosting, I won’t tell). Kids and adults alike with love this frosting! It’s so pretty you can’t help but smile.

ingredients in rainbow frosting laid out on a marble counter.

Ingredients Needed

  • Vanilla Buttercream Frosting: For the best flavor, use my homemade recipe, or three cans of store-bought white or vanilla frosting.
  • Food Coloring: Gel coloring is the best for getting bright and vibrant colors. I usually use americolor gel food coloring but Wilton works too.
  • Cupcakes, Cookies, or Cake: Use your favorite vanilla cupcakes, chocolate cupcakes or anything you want to decorate with the frosting. Use colorful cupcake liners for even more rainbow fun!

I used the colors of the rainbow for this recipe. If you can’t find all of these colors, you can follow the instructions on the box and mix the ones you have to create the colors you want.

How to Make Rainbow Swirl Frosting

  1. You’ll want to make your frosting by mixing softened unsalted butter with powdered sugar, then adding the vanilla extract and heavy cream (or milk). You can make your frosting with a hand mixer or stand mixer. You want a regular frosting consistency – if you’re using gel coloring it won’t thin it like water-based coloring does.
  2. Divide the frosting into six bowls and tint each a different color. Stir well, so the colors are even.
  3. I place my colors in piping bags or sandwich bags and pipe each color in the order of the rainbow onto a large piece of plastic wrap.
  4. Form the frosting into a log by rolling up the plastic wrap and twisting the ends. Cut off one end of the plastic wrap.
  5. Fit a piping bag with a tip (I use a Wilton 1M piping tip which is a star tip). Place the frosting log in the bag, and then pipe the swirl frosting onto your cupcakes or cake. If you want, decorate with rainbow sprinkles or decorations!
vanilla cupcakes with rainbow colored frosting on top.

Expert Tips

  • I’ve already mentioned it, but it’s worth mentioning again: use GEL food coloring for the best results. Generic grocery store food coloring will not produce the same vibrant colors.
  • When you’re tinting your frosting, it’s always good to start with less and then add more to get your desired color.
  • This rainbow frosting is freezer-friendly! Once you’ve rolled it up in the plastic wrap and twisted the ends, place it in a freezer bag or airtight container, and it will keep for two months. Thaw it in the refrigerator before using it.


How to store rainbow frosting?

Once you’ve frosted your cake or cupcakes, keep them loosely covered, and they will keep at room temperature for two days or in the refrigerator for four days.

Overhead shot of rainbow swirl frosting on top of vanilla cupcakes

Rainbow Swirl Frosting Recipe

5 from 2 votes
Rainbow Swirl Frosting is an easy rainbow buttercream recipe perfect for cupcakes, cakes or cookies! Learn how to make swirl frosting – it’s so pretty and easy to do.
Prep Time 30 minutes
Total Time 30 minutes
Yield 16 cupcakes
Serving Size 1 serving


Save this recipe!
Get this sent to your inbox, plus get new recipes from us every week!


  • Divide frosting among 6 bowls.
  • Tint each bowl of frosting a different color, stir to mix.
  • Place each frosting color in a sandwich bag and cut off one tip.
  • Lay a sheet of plastic wrap on your work surface.
  • Pipe a straight vertical line in each color, right next to each other, in the order of the rainbow: red, orange, yellow, green, blue, purple.
  • Roll up the plastic wrap and twist the ends. Cut off one end.
  • Fit a piping bag with desired tip. Add the frosting log.
  • Frost cupcakes or cake as desired.

Recipe Video

Recipe Notes

  • Substitute 3 cans vanilla or white icing from the store.
  • Use GEL food coloring for best results. If you don’t have all 6 colors, refer to the box or website of the brand you’re using to find the color chart for mixing desired colors.
  • Want pink in your rainbow? Skip the red and use pink instead.
  • My cupcakes are frosted with a Wilton 1M tip (open star).
  • Store cupcakes or cake loosely covered on the counter for up to 2 days, in the refrigerator for 4 days or freeze frosting for up to 2 months. Thaw in refrigerator.

Recipe Nutrition

Serving: 1serving | Calories: 50kcal | Carbohydrates: 1g | Fat: 1g | Saturated Fat: 1g | Polyunsaturated Fat: 1g | Monounsaturated Fat: 1g | Sodium: 1mg | Potassium: 1mg | Sugar: 1g | Calcium: 1mg
Nutritional information not guaranteed to be accurate
Course Dessert
Cuisine American

Other Frosting Recipes

Last Updated on February 8, 2024

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.

Leave a Comment

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

Recipe Rating


  1. Thank you for the recipe. I will definitely use this method the next time I make anything that needs frosting. So clever and I love the vibrant colors.