Rainbow Cupcakes Recipe with Six Bright Layers

Updated November 3, 2026

Total time
2 hr 3 min
prep 45 min · cook 18 min
Serves
12
portions as written
Safe temperature (USDA)
160°F / 71°C
check the thickest piece

Jump to recipe

Rainbow Cupcakes Recipe with Six Bright Layers

Rainbow cupcakes are soft vanilla cupcakes made by layering tinted batter in a paper-lined pan, then finishing them with fluffy buttercream. The colors bake into cheerful stripes without changing the simple, familiar cake flavor, making these cupcakes a fun choice for birthdays, school parties, and other celebrations.

Ingredients

  • 1 1/2 cups (190 g) all-purpose flour
  • 1 1/2 teaspoons (6 g) baking powder
  • 1/4 teaspoon (1.5 g) fine salt
  • 1/2 cup (113 g) unsalted butter, softened
  • 3/4 cup (150 g) granulated sugar
  • 2 large eggs (about 100 g without shells), at room temperature
  • 1 teaspoon (5 ml) vanilla extract
  • 1/2 cup (120 ml) whole milk, at room temperature
  • Gel food coloring: 1/8 teaspoon (about 0.6 ml) each red, orange, yellow, green, blue, and violet; add a little more only if needed
  • 3/4 cup (170 g) unsalted butter, softened, for the frosting
  • 3 cups (360 g) powdered sugar, sifted if lumpy
  • 1 teaspoon (5 ml) vanilla extract, for the frosting
  • 2 tablespoons (30 ml) heavy cream or milk, plus up to 1 tablespoon (15 ml) more as needed
  • 1/8 teaspoon (about 0.75 g) fine salt, for the frosting
  • 2 tablespoons (20 g) rainbow sprinkles, optional

Instructions

  1. Prepare the pan and oven. Set a rack in the middle of the oven and heat it to 350°F (175°C). Line a standard 12-cup muffin pan with paper liners. Measure the dry ingredients before mixing, and let the butter, eggs, and milk lose their chill; room-temperature ingredients combine more evenly and help the cupcakes rise with a fine, tender crumb.
  2. Mix the dry ingredients. In a medium bowl, whisk together the flour, baking powder, and salt for about 30 seconds, breaking up any small flour clumps. Set the bowl aside. Evenly distributing the baking powder now helps the cupcakes rise at a similar rate, rather than leaving one section noticeably taller or denser than another.
  3. Cream the butter and sugar. In a large bowl, beat the softened butter and granulated sugar with a hand mixer or stand mixer on medium speed for 2 to 3 minutes, until pale and fluffy. Scrape down the bowl. Beat in the eggs one at a time, mixing until each is incorporated, then mix in the vanilla. If the mixture looks slightly curdled, continue with the recipe; it should come together when the flour is added.
  4. Finish the batter. Add about one-third of the flour mixture and mix on low just until the dry streaks mostly disappear. Add half the milk, then repeat, finishing with the last third of the flour mixture. Scrape the bowl and fold gently with a spatula until no pockets of flour remain. Stop mixing as soon as the batter is smooth; beating it for longer can make the cupcakes tough.
  5. Color six portions. Divide the batter as evenly as possible among six small bowls. Stir 1/8 teaspoon of one gel color into each bowl, using a separate clean spoon for each color. Scrape the bottom of each bowl as you stir so the color is consistent. Gel coloring gives a bright shade with little added liquid; if using liquid food coloring, start with a few drops and expect softer colors or a slightly looser batter.
  6. Layer the batter. Spoon about 2 teaspoons of violet batter into each liner, spreading it gently to cover the base. Add the blue, green, yellow, orange, and red batter in that order, using about 2 teaspoons of each color per cupcake. Drop each layer into the center rather than pushing hard against the liner; the batter will spread outward. Keep the cups no more than about two-thirds full. If a bowl runs short, divide its remaining batter among the cupcakes instead of making one cup unusually full.
  7. Bake and check for doneness. Bake for 18 minutes, until the tops spring back when lightly pressed and a toothpick inserted in the center comes out clean or with a few moist crumbs. For egg safety, USDA FSIS lists 160°F (71°C) as the safe minimum for egg dishes; a cupcake center will usually bake beyond that temperature. Avoid opening the oven during the first 15 minutes, since a sudden temperature drop can make the centers sink.
  8. Cool and make the frosting. Let the cupcakes sit in the pan for 5 minutes, then move them to a wire rack and cool completely, about 55 minutes more. While they cool, beat the frosting butter on medium speed until creamy, about 2 minutes. Add the powdered sugar in three additions on low speed, then beat in the vanilla, salt, and 2 tablespoons of cream. Increase to medium and beat until fluffy; add the remaining cream a teaspoon at a time if it is too stiff to spread or pipe.
  9. Frost and finish. Once the cupcakes are completely cool, spread the frosting with a small offset spatula or pipe a modest swirl onto each one. If the cakes are even slightly warm, the buttercream can melt and slide. Add sprinkles just before serving so they stay crisp and colorful. For clean, visible layers, cut one cupcake in half with a sharp knife and wipe the blade between cuts.

Tips

  • Use gel color for stronger stripes. Gel coloring is concentrated, so a small amount can tint the batter without thinning it. Liquid coloring works if that is what you have, but the baked shades are often lighter. Add color gradually: batter can look more vivid in the bowl than it does after baking.
  • Measure flour lightly. Spoon flour into the measuring cup and level it rather than packing it down. Too much flour can make the cupcakes dry and dense. A kitchen scale is the most reliable option, especially when dividing the batter into six portions.
  • Keep the layers gentle. Use small spoonfuls and avoid stirring the colors together. If a layer does not reach the liner edge, do not force it; the next spoonful will help spread the batter. Try to keep the same order and amount in every cup for neat, even stripes.
  • Let the cupcakes cool fully. Frosting a warm cupcake causes buttercream to soften or melt. If you are short on time, move the cupcakes to a rack with space around them, but do not put hot cupcakes in a sealed container, where trapped steam can make the tops sticky.

Serving Suggestions

Serve the cupcakes at room temperature so the cake is tender and the buttercream is easy to bite through. They look especially striking arranged on a plain white platter, where the frosting and optional sprinkles provide a colorful finish. For a party, place them in individual paper cases or set them out with small plates and napkins; the layers are best revealed by cutting or biting into the cupcake, not by adding extra decorations that hide the top.

These are sweet, vanilla-forward cakes, so pair them with simple drinks such as cold milk, coffee, tea, or lemonade. If serving them after a meal, a smaller frosting swirl keeps the portion from feeling too rich. Bring refrigerated cupcakes out 30 to 45 minutes before serving for a softer crumb, while keeping the display time within safe food-handling limits.

Variations

Change the color order: Layer the colors in any sequence to suit a party theme. A few colors can be used instead of all six, though the batter amount per shade will be larger and the stripes thicker. For a pastel look, use less gel color; for saturated colors, add it in small increments rather than pouring in a large amount at once.

Make a different frosting: A cream cheese frosting can replace the vanilla buttercream for a tangier finish. Because cream cheese frosting is more perishable and softer, keep it refrigerated and add it shortly before serving. You can also flavor the buttercream with 1 teaspoon (5 ml) of lemon juice in place of an equal amount of cream for a light citrus note; the frosting will taste less purely vanilla.

Use a simple dairy substitute: Unsweetened oat milk or soy milk can replace the whole milk in the batter in the same amount. The crumb may be a little less rich, but the cupcakes will still bake successfully. For the frosting, use a plant-based butter stick and plant milk; soft tub spreads can make frosting too loose, so add the liquid gradually.

Make mini cupcakes: Divide the same colored batter among 24 lined mini muffin wells, using a small amount of each shade in every cup. Begin checking them after 9 minutes; they usually take about 10 to 12 minutes, depending on the pan and oven. Cool them fully before piping a small amount of frosting on top. The recipe yield and baking time change when making minis.

Storage and Reheating

Because these cupcakes have homemade buttercream and contain dairy and eggs, refrigerate them within 2 hours of baking or serving. Store them in a covered container in the refrigerator for 3 to 4 days. A tall container prevents the frosting from being pressed against the lid; if you only have a shallow container, chill the cupcakes until the frosting firms before covering them. The colors may look slightly less vivid after refrigeration, but the cake remains enjoyable.

For longer storage, freeze unfrosted cupcakes in a sealed freezer-safe container for up to 2 months. Thaw them, covered, in the refrigerator overnight or at room temperature for about 1 to 2 hours, then frost. Frosted cupcakes can also be frozen, though the decorations may become less tidy; freeze them uncovered until firm first, then cover carefully. These cupcakes do not need reheating. If you choose to warm a leftover, remove any frosting and reheat the cake to 165°F (74°C), the USDA FSIS temperature for reheated leftovers; warming can dry the crumb, so serving at room temperature is preferable.

Frequently Asked Questions

Can I make rainbow cupcake batter ahead?
You can bake the cupcakes a day ahead and frost them later, but it is best to color and layer the batter just before baking. Batter that sits after mixing can lose some of its rise as the baking powder reacts, and the colors may be harder to layer neatly. Store cooled, unfrosted cakes covered in the refrigerator, then bring them close to room temperature before frosting.

Why did my cupcakes turn out brown or muddy between colors?
Colors can blur if the batter is overmixed after tinting or if each layer is pushed hard into the one below. Stir the coloring in only until even, use small spoonfuls, and place each new color gently in the center. A little blending at the boundaries is normal. Very dark colors can also look muddy when combined, so use a light hand with the gel.

Can I use a boxed cake mix?
Yes. Prepare a vanilla or white cake mix according to its package directions, then divide the mixed batter among six bowls and tint each portion. Follow the package temperature and baking guidance, checking doneness near the earliest suggested time because pan sizes and cake mixes vary. The result may have a slightly different crumb and flavor, but the colored layers will still work.

Can I make these cupcakes without food coloring?
Yes, but they will be vanilla cupcakes without the rainbow effect. Natural color powders can tint batter, though their shades may be muted and some can add a faint flavor. Use a product intended for baking and follow its label directions; do not add large amounts of juice or puree to create color, since extra liquid can change the batter texture and baking time.

How do I know if the cupcakes are fully baked?
The tops should spring back when touched lightly, and a toothpick inserted in the middle should come out clean or with a few moist crumbs rather than wet batter. Start checking at 18 minutes, since ovens and pans differ. If the center still looks wet, bake for another minute or two and check again. Avoid relying on color alone, because the tinted batter can make visual cues less obvious.

Related

More recipes to cook

Safety notes: safe minimum internal temperatures from USDA FSIS; raw and undercooked fish guidance from the U.S. FDA. Food safety notes

Spotted an error? Tell us and we will correct it (corrections policy).