This post may contain affiliate links. Please read our disclosure policy.
This flag cake comes out every 4th of July at my house, and at this point, my family would notice if it didn’t show up.

I’ve made a lot of flag cakes over the years. What I kept coming back to was the frosting. I wanted something that would hold its shape in the heat, pipe into clean stripes and stars without deflating, and not feel heavy by the time dessert rolled around at the end of the night. A pudding and whipped topping frosting does all of that in a way a traditional cream cheese base doesn’t.
The frosting is what makes this version different. A pudding and whipped topping combination is not something you usually see on a from-scratch cake, and that’s the whole point.
The pudding thickens the frosting just enough to hold its shape for piping, while the whipped topping keeps it airy. It doesn’t taste heavy. It tastes like summer.
If you’re building out your 4th of July dessert spread, my 4th of July Trifle is another crowd-pleaser that can be made ahead. And my 4th of July Desserts roundup has even more red, white, and blue ideas for the whole table.

key Ingredients
- Buttermilk. I use buttermilk here and it’s not negotiable. The acid reacts with the baking powder and tenderizes the crumb in a way regular milk won’t. It’s worth picking up a carton.
- Sour cream and vegetable oil. I use both, and they work as a team. The oil keeps the crumb moist even after the cake cools to room temperature. The sour cream adds a quiet richness and helps the butter and sugar cream properly. Both stay in.
- Instant vanilla pudding mix. This is the ingredient that makes the frosting work the way it does. The pudding thickens the cold milk into a base that holds its shape without being stiff. You end up with a frosting that spreads smoothly, pipes into clean lines and stars, and doesn’t weigh down the fruit. I’ve also made this with white chocolate and cheesecake flavored instant pudding and both work.
- Whipped topping, fully thawed. I move mine from the freezer to the fridge the night before. If it’s still partially frozen when it goes into the frosting, it won’t fold in evenly and you’ll end up with lumps. Completely thawed is the only way this works.
- Whole milk, very cold. Take it straight from the fridge when you’re ready to make the frosting. Warm milk won’t let the pudding thicken the way it needs to.
- Fresh berries, large and uniformly sized. I shop for the biggest, most evenly sized berries I can find, and it makes a real difference. When the blueberries are all roughly the same size, the rows sit evenly. When the strawberry halves are consistent, the stripes line up cleanly.

How to Make Flag Cake
Make the Cake
Step 1: Prep the pan. Preheat the oven to 350°F. Lightly spray a 12x17x1-inch half sheet pan with nonstick baker’s spray and set it aside.
Step 2: Sift the dry ingredients. Sift together 2 1/2 cups all-purpose flour, 2 teaspoons baking powder, and 1/2 teaspoon salt into a medium bowl. Set aside.
Step 3: Cream the butter and sugar. In the bowl of a stand mixer fitted with the paddle attachment, beat 1 3/4 cups granulated sugar and 3/4 cup room-temperature unsalted butter on medium-high speed for 4 to 5 minutes, until very light and fluffy. I set a timer for this one. The full creaming time is what gives you a light crumb, don’t cut it short.
Step 4: Add the eggs and vanilla. Reduce the speed to low and add 3 large room-temperature eggs one at a time, followed by 1 tablespoon of vanilla extract. Let each egg fully incorporate before adding the next, and scrape the bowl as needed. The batter may look slightly curdled at this point – that’s normal.
Step 5: Add the sour cream and oil. Add 1/2 cup sour cream and 1/4 cup vegetable oil. Mix on low speed until fully combined.
Step 6: Alternate the flour and buttermilk. With the mixer on low, add the flour mixture and 1 cup buttermilk in alternating additions – start and end with flour. Add a third of the flour, then half the buttermilk, another third of the flour, the remaining buttermilk, then finish with the last of the flour. Let each addition fully incorporate before adding the next, and scrape the bowl as needed.
Step 7: Bake and cool. Spread the batter into an even layer in the prepared pan. Bake for 16 to 18 minutes – I start checking at 16 every time. The cake is done when the edges are very lightly golden, the center springs back when pressed, and a toothpick comes out with just a few moist crumbs. Let it cool completely before adding frosting. A warm cake will melt everything.
Make the Frosting
Step 1: Dissolve the powdered sugar. In a large mixing bowl, beat 1 1/2 cups very cold whole milk and 1/2 cup sifted powdered sugar together on low speed for 15 to 30 seconds, until fully dissolved.
Step 2: Add the pudding and thicken. Add both 3.4-ounce boxes of instant vanilla pudding mix and beat for 1 to 1 1/2 minutes, until the mixture thickens. Set it aside for 2 to 3 minutes to let it fully set before folding in the topping.
Step 3: Fold in the whipped topping. Using a rubber spatula, gently fold in 2 containers of fully thawed whipped topping until the frosting is smooth and combined.
Decorate the Flag
Step 4: Frost the cake. Spread about two-thirds of the frosting evenly over the cooled cake. Transfer the remaining frosting to a large piping bag fitted with a large star tip. I use a #16 or #21 – either works well for both the stripes and the stars.
Step 5: Place the blueberries. In the upper left corner of the cake, arrange 48 blueberries in 6 rows of 8. Take your time here. A messy blueberry section throws off the whole design.
Step 6: Add the strawberry stripes. Place halved strawberries in rows across the remaining frosted area of the cake. Leave white frosting space between each row – that’s where the white stripes go.
Step 7: Pipe the white stripes and stars. Pipe the frosting in straight lines between the rows of strawberries to create the white stripes. Then pipe small stars between the blueberries – about 16 total. Whether you end up with dots or actual stars depends on the tip, but a star tip gives the cleanest result.
Step 8: Refrigerate until serving. Keep the decorated cake in the refrigerator until you’re ready to serve.

Make-Ahead and Storage
- I bake this the morning of every time. Let it cool completely, cover the pan tightly, and leave it at room temperature. Frost and decorate within a few hours of serving.
- Once frosted and decorated, it will keep in the refrigerator for up to 2 days. The berries release moisture as the cake sits and the frosting will gradually soften.
- Same-day is the sweet spot. I don’t recommend frozen fruit for decorating this one.

Frequently Asked Questions
I only tested this recipe with the from-scratch cake, so that’s what I recommend. The combination of buttermilk, sour cream, and oil is what gives this cake its texture, and a boxed mix will behave differently. If you go the semi-homemade route, know the texture and bake time will vary from what’s described here.
Use a medium star tip for both. Different brands number their tips differently, but a #16 or #21 size will give you clean, defined stripes and stars. If you only have one tip, use it for both.
More 4th of July Recipes
- Firecracker Cupcakes
- 4th of July Sugar Cookies
- 4th of July Cake Pops
- Patriotic Chocolate Covered Strawberries

Flag Cake
Ingredients
Cake
- 2 ½ cups all-purpose flour
- 2 teaspoons baking powder
- ½ teaspoon salt
- 1 ¾ cups granulated sugar
- ¾ cup unsalted butter room temperature
- 3 large eggs room temperature
- 1 tablespoon vanilla extract
- ½ cup sour cream
- ¼ cup vegetable oil
- 1 cup buttermilk
Frosting
- 1 ½ cups whole milk very cold
- ½ cup powdered sugar sifted
- 2 boxes (3.4 ounce) instant vanilla pudding
- 2 containers (8 ounce) whipped topping thawed
Toppings
- 48 large fresh blueberries
- 26-28 26-28 whole fresh strawberries halved
Instructions
Cake
- Preheat the oven to 350°F. Lightly spray a 12x17x1-inch half sheet pan with non-stick baker’s spray and set aside.
- Sift together the all-purpose flour, baking powder, and salt in a medium bowl. Set aside.2 ½ cups all-purpose flour, 2 teaspoons baking powder, ½ teaspoon salt
- In the bowl of a stand mixer fitted with the paddle attachment, cream together the granulated sugar and unsalted butter on medium-high speed for 4-5 minutes or until very light and fluffy.1 ¾ cups granulated sugar, ¾ cup unsalted butter
- Reduce the speed to low and add the eggs, one at a time, followed by the vanilla extract. Be sure to fully incorporate each egg before adding the next. Scrape the bowl and paddle as needed to ensure even mixing of the ingredients.3 large eggs, 1 tablespoon vanilla extract
- Add the sour cream and vegetable oil. Mix on low speed just until fully combined.½ cup sour cream, ¼ cup vegetable oil
- With the mixer on low, add a third of the flour mixture, followed by ½ cup of the buttermilk, another third of the flour mixture, the remaining ½ cup buttermilk, and the final third of the flour mixture. Be sure to allow each addition to fully incorporate into the batter before adding the next. Scrape the bowl and paddle as needed to ensure the batter is evenly combined.1 cup buttermilk
- Spread the batter into an even layer in the prepared pan. Bake for 16-18 minutes or just until the edges are very lightly browned and the center springs back when lightly pressed. A toothpick inserted into the center should come out with just a few moist crumbs. Allow the cake to cool completely in the pan before adding the frosting and berries.
Frosting
- Using a large mixing bowl and a handheld mixer on low speed, add the cold milk and powdered sugar. Beat for 15-30 seconds or until the powdered sugar is fully dissolved into the milk.1 ½ cups whole milk, ½ cup powdered sugar
- Add the vanilla instant pudding mix and beat for 1 to 1 ½ minutes or just until thickened. Set aside for 2-3 minutes to fully set.2 boxes (3.4 ounce) instant vanilla pudding
- Using a rubber spatula, gently fold in the thawed whipped topping until thoroughly combined.2 containers (8 ounce) whipped topping
- Spread about two-thirds of the frosting evenly over the cooled cake. Transfer the remaining frosting to a large piping bag fitted with a large decorative piping tip. (A medium size star tip will also work for both the stripes and the stars. Keep in mind that different brands will be numbered differently, but a #16 or 21 size tip will work.)
- Top the cake with the fresh blueberries and strawberry halves in the pattern of the American flag. In the upper left hand corner place 6 rows, with 8 blueberries in each row, to create the blue area where the stars go. Then place the halved strawberries in rows across the rest of the frosted cake (representing the red strips of the flag), being sure to leave some white space between rows of strawberries.48 large fresh blueberries, 26-28 26-28 whole fresh strawberries
- Once the fruit is properly placed, pipe the frosting in straight lines in the spaces between the strawberry rows to represent the white strips of the flag.
- Use the remaining frosting to place little dots or stars between the blueberries, (about 16 stars). The design (dots versus stars) will depend on the type of tip used for the piping, but we recommend stars.
Jenn’s Notes
- For best results, bake this cake the morning you plan to serve it. Allow it to cool completely, then cover the pan tightly and keep it at room temperature until you’re ready to add the frosting and decorations, ideally within a few hours of serving.
- If you have leftovers, the frosted and decorated cake can be stored in the refrigerator for up to 2 days. Keep in mind that the berries will release moisture over time, causing the frosting to gradually soften.
- For the best experience, serving it the same day is the way to go. Fresh fruit is also strongly recommended for decorating, as frozen fruit doesn’t work well for this cake.
- Since every oven runs a little differently, start checking your cake at the earlier end of the baking time. This helps prevent overbaking, which can leave you with a dry cake.
- Make sure your frozen whipped topping is fully thawed before folding it into the pudding mix. This step is key to getting that perfect, creamy frosting consistency.
- Give your blueberries and strawberries a good rinse and make sure they are thoroughly patted dry before placing them on the cake. Excess moisture can affect how they sit on top.
- When it comes to decorating, stick with fresh fruit only. Frozen fruit isn’t recommended for topping this cake.
- Feel free to swap the vanilla pudding mix for white chocolate or cheesecake flavored instant pudding if you’d like a different twist on the frosting. Just note that sugar-free varieties haven’t been tested in this recipe.







