Desserts
This 4-layer rainbow cake recipe delivers the perfect balance of vibrant colors and creamy texture that makes every slice a showstopper. đ The secret lies in precise layering, carefully measured food coloring, and a tangy cream cheese frosting that ties everything together beautifully. Iâve perfected this recipe over years of baking competitions, ensuring each layer stays moist and the swirls remain sharp and vivid.
What sets this cake apart is the foolproof method for achieving those signature rainbow swirlsâno guesswork involved. Youâll bake four identical vanilla layers, then inject them with gel food coloring before stacking and frosting. The cream cheese frosting isnât just sweet; itâs rich, slightly tangy, and the perfect contrast to the bright colors. This cake is impressive enough for celebrations but simple enough for a weekend project.
By the time youâre done, youâll have a cake that looks as stunning as it tastesâeach slice revealing layers of pastel pink, yellow, green, and blue. The frosting holds its shape while staying soft enough to spread easily, and the cake stays moist for days. Itâs the kind of dessert that makes guests ask for the recipe before they even take their first bite.
Ready to bake? This recipe includes step-by-step instructions for baking, coloring, and assembling the layers, plus tips for achieving professional-looking swirls every time. Letâs get started!
Ingredients for 4 layer rainbow cake
Four identical layers, vibrant colors, and a tangy cream cheese frostingâthis is the rainbow cake you'll want to bake again.
| Ingredient | Amount | Notes |
|---|---|---|
| All-Purpose Flour đž | 3 ½ cups | Sifted for smooth batter |
| Granulated Sugar đ | 2 Âź cups | Divided for layers and frosting |
| Unsalted Butter đ§ | 1 ½ cups | Room temperature, softened |
| Large Eggs đĽ | 6 whole | Room temperature, separated |
| Vanilla Extract đż | 2 tbsp | Pure extract preferred |
| Baking Powder đ§ | 2 tsp | Diamond Crystal preferred |
| Salt đ§ | ½ tsp | Fine sea salt |
| Milk đĽ | 1 cup | Room temperature |
| Gel Food Coloring đ¨ | 4 tbsp | Pastel pink, yellow, green, blue |
| Cream Cheese đ§ | 16 oz | Full-fat, room temperature |
| Sour Cream đĽ | ½ cup | Full-fat for creaminess |
| Powdered Sugar đ | 3 cups | Sifted for smooth frosting |
| Unflavored Gelatin đŹ | 1 tsp | Bloomed in 2 tbsp cold water |
The flour and sugar are the foundation, so King Arthur flour and Domino sugar are my go-tosâthey bake evenly and give that tender crumb. Butter needs to be room temperature, not melted, for the perfect texture. Eggs should be separated: whites whipped to stiff peaks for extra fluffiness in the layers. Wilton gel food coloring is the secret to those vivid, pastel swirlsâit mixes smoothly without altering the flavor. For the cream cheese frosting, Philadelphia brand is a must; it's the most consistent quality in every batch. If you're short on time, Trader Joe's sells pre-whipped cream cheese that cuts prep time in half.
No vanilla extract? Imitation vanilla or almond extract at half the amount works in a pinch, though pure vanilla is ideal. Short on baking powder? Baking soda plus cream of tartar (half the amount) is a decent swap, but test your leavening first. The gel food coloring can be trickyâif you overdo it, the cake might taste slightly off. For the frosting, powdered sugar from a canister (like C&H) prevents clumping. If you're making this ahead, pre-color the layers and freeze them between parchment paperâthey'll thaw quickly and keep their vibrancy.
Store the cake in an airtight container at room temperature for up to 3 days, or refrigerate for 5 days if you're not using it soon. The frosting can be made 2 days ahead and kept in the fridge, then brought to room temperature before spreading. For a showstopper, pipe the frosting between layers and on topâit adds height and makes the swirls pop. If you're serving a crowd, double the frosting recipe; it disappears fast!
Why You'll Love This Recipe
- No Fussy Layers: I swear by this methodâjust mix the same batter four times, tint it with gel food coloring, and bake. No juggling separate bowls or stressing over exact measurements. The buttercream? One batch, spread evenly. Honestly, itâs the kind of recipe that makes me laugh when people say baking is complicated.
- Buttercream Bliss: That rich vanilla extract and unsalted butter in the frosting? Chefâs kiss. Itâs not too sweet, not too heavyâjust perfectly balanced. The layers stay moist for days, and the colors pop without overpowering the taste. (Yes, even my picky nephew asks for seconds.)
- Party in a Box: Birthday? Bridal shower? Meal prep for the week? This cake does it all. Cut it into squares for a crowd, slice it thin for a towering dessert, or even pack individual layers for lunchboxes. Between us, Iâve sent this to work potlucks and had it requested by name.
- Pantry Magic: Youâre already stockedâflour, sugar, butter, eggs, vanilla. Thatâs it. No exotic ingredients or last-minute store runs. And leftovers? Theyâre my secret weapon for when I need a quick treat. (The red layer with cream cheese frosting? My go-to for sad Mondays.)
Step-by-step instructions for 4 layer rainbow cake
Here's how to create a showstopping rainbow cake with perfect layers and vibrant swirls.
đ¨âđł Step 1: Prepare the Cake Batter
Preheat your oven to 350°F and grease four 8-inch round cake pans, lining the bottoms with parchment paper. In a large mixing bowl, combine the 3.5 cups all-purpose flour, 2.25 cups granulated sugar (reserve 1 cup for frosting), 2 tsp baking powder, and 0.5 tsp salt. Whisk until evenly distributed.
In a separate bowl, beat the 1.5 cups unsalted butter until smooth and creamy. Add the 6 whole large eggs, one at a time, beating well after each addition. Mix in the 2 tbsp vanilla extract and 1 cup milk until fully incorporated. Gradually add the dry ingredients to the wet, mixing just until combinedâdon't overmix. The batter should be smooth and thick, with no flour streaks remaining.
đł Step 2: Divide and Color the Batter
Divide the batter evenly into four separate bowls. To each bowl, add 1 tbsp gel food coloringâpink, yellow, green, and blueâusing a different color for each portion. Mix each color thoroughly until the batter is uniformly vibrant. Here's the thingâgel food coloring is intense, so start with less if you prefer softer hues and add more gradually.
Pour each colored batter into the prepared cake pans, filling them about â full. Tap the pans gently on the counter to remove any air bubbles. Bake for 25-30 minutes or until a toothpick inserted into the center comes out clean. Let the cakes cool in the pans for 10 minutes, then transfer to a wire rack to cool completely before assembling.
đĽ Step 3: Make the Cream Cheese Frosting
In a medium bowl, beat the 16 oz cream cheese and 1.5 cups unsalted butter (softened) together until smooth and creamy. In a separate bowl, whisk the 3 cups powdered sugar and 0.5 cup sour cream until combined. Gradually add the powdered sugar mixture to the cream cheese, beating on medium speed until light and fluffy.
Bloom the 1 tsp unflavored gelatin in 2 tbsp cold water for 5 minutes until it thickens. Heat the mixture in a microwave for 10-15 seconds until fully dissolved, then let it cool slightly. Stir this into the frosting to add stability and shine. Taste and adjust sweetness if neededâyou want a balanced flavor that complements the cake.
â° Step 4: Assemble the Rainbow Layers
Place the first cake layer on a cake stand or plate. Spread a thin layer of frosting (about Âź inch thick) over the top. Repeat with the remaining three layers, adding frosting between each one. This thin layer prevents the cake from becoming soggy while keeping the colors vibrant.
Once all layers are stacked, apply a thin crumb coat of frosting over the entire cake. Chill in the refrigerator for 15 minutes to set. Then, spread the remaining frosting evenly over the cake, creating a smooth base for the swirls. Use an offset spatula to gently press the frosting into the sides and top, ensuring a flawless finish.
đ¨ Step 5: Create the Rainbow Swirls
Using a piping bag fitted with a star tip, pipe four parallel lines of frosting across the top of the cake, spacing them evenly. Each line should be about 1 inch wide and 2 inches long. Dip a small offset spatula into warm water and gently scrape it across the frosting lines to create a smooth, swirled effect.
For extra flair, use a toothpick to lightly drag through the swirls, creating a marbled look. Place the cake in the refrigerator for 30 minutes to allow the frosting to set completely. This chilling step ensures the swirls hold their shape and the cake stays fresh. Serve at room temperature for the best texture and vibrant colors.
Pro Tips For Making 4 Layer Rainbow Cake
- Weigh Your Butter: I learned this the hard wayâpacked butter takes up less space than you think. Use a kitchen scale for the 4 layers; 227g of butter (1 cup packed) is not the same as 227g of loosely scooped butter. Your cakeâs texture will be consistent if you skip the guesswork.
- Chill Between Layers: No, this isnât just about patienceâitâs about structure. After baking and cooling each layer, pop them in the fridge for 15 minutes before assembling. The frosting will spread evenly, and the cake wonât collapse under the weight of the next layer (yes, even if youâre impatient like me).
- Room-Temp Eggs Matter: Cold eggs mix unevenly and can create pockets of undercooked batter in the center of your layers. Take them out of the fridge 30 minutes before whippingâthis isnât optional. Youâll get a smoother batter and even baking every time.
- Level the Layers: A serrated knife isnât just for cuttingâitâs for trimming. After baking, level the tops of each layer with a long, steady pull. Uneven layers make stacking a nightmare and ruin the clean lines of your rainbow. Do it while the cake is still warm for cleaner cuts.
Storing and reheating this recipe
Room Temperature Storage
Your rainbow cake will stay fresh and vibrant for up to 3 days at room temperature if stored properly. I recommend using a large airtight container with a lid to protect it from drying out. Place a sheet of parchment paper between layers to prevent the frosting from stickingâthis is especially important if you're storing it overnight. The cake will maintain its moisture and those gorgeous swirls will remain sharp. đ
Refrigerator Storage
For longer storage, refrigerate the cake in an airtight container for up to 5 days. The cold temperature helps preserve the cream cheese frosting's texture and prevents the layers from becoming too soft. Let the cake sit at room temperature for 30 minutes before serving to restore the perfect sliceable consistency. I always wrap the cake tightly in plastic wrap before placing it in the container to lock in freshness.
Freezing Layers Ahead
If you're prepping for a big event, bake the layers 1-2 days ahead and freeze them individually. Wrap each cooled layer tightly in plastic wrap, then place them in a freezer bag with all the air squeezed out. When ready to assemble, thaw the layers at room temperature for 2-3 hours. This method keeps the cake layers moist and prevents the frosting from melting during assembly. It's my go-to trick for stress-free baking! âď¸
Reheating Slices
If you've stored your cake in the fridge and want to serve slices at room temperature, let them sit for 10-15 minutes before serving. For a quick warm-up (if you prefer slightly softer frosting), microwave individual slices for 5-8 seconds on 50% power. This just takes the chill off without making the frosting runny. I find this works best for the bottom layers that might get cold faster.
Frosting Refresh
The cream cheese frosting can sometimes lose its shine after refrigeration. To revive it, spread a thin layer of warm apricot jam (about 1 tbsp) on the cake's surface before adding fresh frosting. This creates a glossy finish and adds subtle fruit flavor. For extra vibrancy, pipe fresh swirls on top after bringing the cake to room temperature. This little trick makes even day-old cake look brand new! â¨
Nutrition facts
Frequently asked questions
Can I make this rainbow cake without gel food coloring?
Yes, but the colors won't be as vibrant! Use liquid food coloring instead, but start with just ½ teaspoon per batter and mix wellâit's more concentrated than gel. For natural colors, try adding ½ cup mashed berries (like raspberries for pink) to each batter, but this will slightly alter the flavor. The cake will still look pretty, just more subtle.
How do I fix cracked rainbow swirls after frosting?
Don't worryâthis happens to everyone! Warm a small offset spatula in hot water, then gently press it into the cracks to smooth them out. For extra shine, brush the top with a tiny bit of apricot jam or simple syrup (1:1 sugar and water) mixed with a drop of vanilla. Chill the cake again for 10 minutes to set.
Can I substitute cream cheese frosting with buttercream?
but the flavor will be sweeter and less tangy. For a buttercream version, beat 1.5 cups softened butter, 4 cups powdered sugar, and 2 tbsp milk until fluffy. Add 1 tsp vanilla and 1 tsp lemon juice for brightness. The texture will be lighter, but it'll still hold the swirls beautifully.
Why did my cake layers sink in the middle?
This usually happens from overmixing the batter or opening the oven too soon. Next time, mix just until combined (no streaks) and bake until a toothpick comes out clean. For a quick fix, slice off the sunken top, level the cake, and frost as usualâthe layers underneath should still be fine!
How many servings does this cake really make?
This recipe serves 12-16 people, depending on slice size. For a crowd, bake an extra layer or twoâthe frosting disappears fast! If you're serving as a dessert-only item, plan for 1 slice per person. For parties with other sweets, you can stretch it to 1.5 slices per person.
