Dinners

Fourth of July Cookie Bars: Easy Flag Recipe

Updated · By Patriot Kitchen

Total timeincludes chilling, rising or resting
1 hr 45 min
Prep
30 min
hands-on
Cook
25 min
oven or stovetop
Serves
24
as written

Jump to recipe Save

Time: 1 hr 45 min · Serves: 24 · The key step: Chill the dough before baking so the bars hold their shape and cut cleanly.

These cookie bars are a single pan of soft sugar-cookie dough topped with a sweet cream-cheese frosting and a berry flag. They suit a July 4th cookout, potluck, or any summer gathering where you want dessert without rolling individual cookies.

Ingredients

  • 2 1/2 cups (315 g) all-purpose flour
  • 1/2 tsp baking soda
  • 1/2 tsp salt
  • 3/4 cup (170 g) unsalted butter, softened
  • 1 cup (200 g) granulated sugar
  • 1 large egg, at room temperature
  • 2 tsp vanilla extract
  • 1/4 cup (60 ml) milk

For the frosting:

  • 4 oz (115 g) cream cheese, softened
  • 1/4 cup (60 g) unsalted butter, softened
  • 1 1/2 cups (180 g) powdered sugar
  • 1 tsp vanilla extract
  • 1–2 tbsp (15–30 ml) milk, as needed

For the flag design:

  • 1 cup (about 150 g) fresh blueberries
  • 2 cups (about 300 g) fresh raspberries or sliced strawberries

Instructions

  1. Preheat oven to 375°F (190°C). Line a 9×13-inch (23×33 cm) baking pan with parchment paper, leaving overhang on two sides.
  2. In a medium bowl, whisk flour, baking soda, and salt. Set aside.
  3. In a large bowl, beat butter and sugar with an electric mixer on medium speed until light and fluffy, about 2 minutes. Add egg and vanilla; beat until combined. Reduce speed to low and add flour mixture alternately with milk, beginning and ending with flour. Mix just until no dry streaks remain.
  4. Press dough evenly into the prepared pan. Chill in the refrigerator for 20 minutes (or freeze 10 minutes) to firm the dough.
  5. Bake for 20–25 minutes, until edges are lightly golden and a toothpick inserted in the center comes out with moist crumbs (not wet batter). Cool completely in the pan on a wire rack, about 1 hour.
  6. For the frosting: beat cream cheese and butter until smooth. Gradually add powdered sugar and vanilla; beat until fluffy. Add milk 1 tablespoon at a time until spreadable. Spread over the cooled bars.
  7. Arrange blueberries in a 3-inch (7.5 cm) square in the top-left corner to form the star field. Place raspberries or strawberry slices in rows across the rest of the frosting to form red stripes, leaving white frosting stripes between them. Refrigerate 30 minutes to set the frosting before cutting.
  8. Use the parchment overhang to lift the slab onto a cutting board. Cut into 24 bars (6 rows by 4 columns) with a sharp knife. Serve chilled or at room temperature.

Why the Bars Turn Out Dry and How to Fix It

Dry bars come from overbaking or too much flour. The dough should be soft and slightly sticky; if it feels stiff, add 1–2 tablespoons more milk. Bake only until the edges are golden and the center is just set—overbaking by even 3 minutes dries the crumb. If your oven runs hot, check at 18 minutes.

Why the Bars Turn Out Runny or Soggy

A runny center means the dough was too wet or the bars were underbaked. Measure flour by spooning into the cup and leveling, not scooping. If you added extra milk, reduce it by a tablespoon. The bars are done when a toothpick comes out with moist crumbs, not wet batter. Also, cool completely before frosting—warm bars will melt the frosting and make the top soggy.

Why the Bars Turn Out Dense and Heavy

Dense bars usually come from overmixing the dough, which develops too much gluten. Mix only until the flour disappears. Also, make sure your baking soda is fresh—test by dropping a pinch into vinegar; it should fizz. If it doesn’t, replace it.

Scaling the Recipe for a Half or Double Batch

Batch Pan size Bake time Yield
Half 8×8-inch (20×20 cm) 18–22 min 12 bars
Full 9×13-inch (23×33 cm) 20–25 min 24 bars
Double Two 9×13-inch pans 20–25 min each 48 bars

For a half batch, halve all ingredients and use an 8×8-inch pan. For a double batch, make two full batches rather than one huge pan—a single larger pan would bake unevenly.

Storing and Making Ahead

Store frosted bars in an airtight container in the refrigerator for up to 4 days. The frosting contains cream cheese, so keep them chilled and bring to room temperature before serving if you prefer. You can freeze the unfrosted bars for up to 3 months: wrap the cooled slab tightly in plastic wrap, then foil. Thaw overnight in the fridge, then frost and decorate. Do not freeze frosted bars—the berries will weep and the frosting may separate.

Swaps That Work

Use lemon zest (1 tsp) in the dough for a citrus note. Replace raspberries with sliced strawberries, but pat them dry before placing to avoid bleeding. For a dairy-free version, use plant-based butter and cream cheese; the texture will be slightly softer. If you don’t have cream cheese, use a simple buttercream: 1/2 cup (115 g) butter, 2 cups (240 g) powdered sugar, and 2–3 tbsp milk.

Food Safety Notes

This recipe uses raw flour and egg in the dough. Heat-treat the flour before using: spread it on a baking sheet and bake at 350°F (175°C) for 5 minutes, then cool. Use pasteurized eggs or an egg substitute. Pregnant people, young children, older adults, and anyone with a weakened immune system should avoid raw flour and raw eggs. The finished bars are fully baked, so they are safe once cooked. Keep frosted bars refrigerated and discard any left out for more than 2 hours.

Related

Safe minimum internal temperatures follow USDA FSIS; raw-fish guidance follows the U.S. FDA. See our food safety notes.

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