Magic Cookie Bars

published Feb 17, 2024
Magic Cookie Bars Recipe
Jump to Recipe
We independently select these products—if you buy from one of our links, we may earn a commission. All prices were accurate at the time of publishing.
head on shot of three magic cookie bars stacked on each other, showing the chocolate chips inside.
Credit: Photo: Alex Lepe ; Food Stylist: Rachel Perlmutter

If you’re looking for a dessert that’s stood the test of time, look no further than magic cookie bars. Part cookie and part candy, these bars feature a graham cracker crust, chocolate and butterscotch chips, shredded coconut, and pecans, which are magically bound together with sweetened condensed milk. 

Magic cookie bars are simple to make and unbelievably delicious, so it’s no wonder they’ve been a favorite for decades. Here’s how to make them.

The History Behind Magic Cookie Bars

You might know magic cookie bars as Hello Dolly bars, 7-layer bars, coconut dream bars, or even fancy layer bars.

The exact origin of the bars and how they got their name remains lost to history, but there are some clues. Borden, the makers of Eagle Brand sweetened condensed milk, shared a recipe for magic cookie bars on their can labels and in women’s magazines in the 1960s. Another theory points to the opening of the Broadway musical Hello Dolly in 1964 and desserts named after the production with a familiar list of ingredients soon followed.

Regardless of who invented these cookie bars or what you call them, the recipe took off with busy home cooks and home economics teachers needing a quick and tasty recipe for their students. Magic cookie bars are a nostalgic treat that remain popular today.

Key Ingredients in Magic Cookie Bars

  • Graham crackers: Crush graham crackers until finely ground or opt for store-bought graham cracker crumbs.
  • Unsalted butter: Melted unsalted butter binds the graham cracker crumbs into a cookie crust.
  • Chocolate chips: Semi-sweet chocolate chips are best, but you can substitute with milk or dark chocolate chips.
  • Butterscotch chips: These chips have a buttery, caramel flavor. 
  • Shredded coconut: Use finely shredded coconut. Both sweetened and unsweetened work in this recipe.
  • Pecans: Coarsely chopped pecans give the bars a nutty crunch. You can substitute with other nuts like walnuts.
  • Sweetened condensed milk: This thick, sweetened canned milk binds the bars together.
Credit: Photo: Alex Lepe ; Food Stylist: Rachel Perlmutter

How to Make Magic Cookie Bars

  1. Prepare the baking pan. Line a 9×13-inch baking pan with two sheets of parchment paper, arranged perpendicular. The parchment paper keeps the bars from sticking to the pan and makes it easy to lift them out of the pan for easy cutting.
  2. Make the graham cracker crust. Crush the graham crackers and combine with melted unsalted butter and kosher salt. Press into the pan with the bottom of a measuring cup, making sure to get into the corners. The mixture may be crumbly, but the sweetened condensed milk added at the end will hold everything together.
  3. Layer with remaining ingredients. Sprinkle the chocolate chips, butterscotch chips, shredded coconut, and chopped pecans evenly over the crust.
  4. Finish with sweetened condensed milk. There’s debate over whether it is best to pour the sweetened condensed milk over the crust, or to add it after all of the toppings have been added. Finishing with the sweetened condensed milk binds all of the layers together and gives the top a caramel-colored sheen.
  5. Bake and cool the bars. Bake the bars until golden-brown and set. Get the cleanest cut by letting the bars cool completely before slicing into bars.

What Is the Difference Between Sweetened Condensed Milk and Evaporated Milk?

It’s easy to understand why sweetened condensed milk and evaporated milk can be confused for one another. Both are shelf-stable, concentrated (with about 60% of the water removed) milks sold in small cans, but they are completely different products. Here’s the difference between sweetened condensed milk and evaporated milk.

  • Sweetened condensed milk: Sweetened (40 to 45% sugar), caramel-colored, thick, and rich. May also be called condensed milk. Used in beverages and desserts.
  • Evaporated milk: Thinner consistency, unsweetened, and sold in non-fat, low-fat, and whole varieties. Used in savory and sweet recipes that require extra creaminess but not extra sweetness.

How to Store Magic Cookie Bars

Place magic cookie bars in an airtight container and store at room temperature for up to 3 days. For longer storage, freeze the bars for up to 3 months. The bars can be eaten straight from the freezer for a chewy texture, or thawed before serving. 

Magic Cookie Bars Recipe

This old-school treat has seven sweet layers.

Prep time 18 minutes

Cook time 25 minutes to 27 minutes

Makes Makes 20 (2.5-inch) bars

Nutritional Info


  • 1 cup

    pecans (4 ounces)

  • 6 tablespoons

    (3/4 stick) unsalted butter

  • 12

    full graham cracker sheets (6 1/2 ounces), or 1 1/2 cups graham cracker crumbs

  • 1/4 teaspoon

    kosher salt

  • 1 cup

    semi-sweet chocolate chips (6 1/2 ounces)

  • 1 cup

    butterscotch chips (6 1/2 ounces)

  • 1 cup

    sweetened or unsweetened shredded coconut (1 3/4 ounces for unsweetened and 2 3/4 ounces for sweetened)

  • 1

    (14-ounce) can sweetened condensed milk


  1. Arrange a rack in the middle of the oven and heat the oven to 350°F. Line the bottom and sides of a 9x13-inch baking pan with 2 sheets of parchment paper, positioning them perpendicular to each other and making sure they are long enough to hang over all four sides by at least 1 inch to form a sling.

  2. Coarsely chop 1 cup pecans. Place 6 tablespoons unsalted butter in a large microwave-safe bowl. Microwave on HIGH until just melted, about 40 seconds (alternatively, melt on the stovetop and pour into a large bowl).

  3. Place 12 full graham cracker sheets in a large zip-top plastic bag. Seal the bag, then crush with a rolling pin or flat side of a meat mallet into finely ground crumbs (about 1 1/2 cups). Transfer to the bowl of butter, add 1/4 teaspoon kosher salt, and stir until evenly moistened.

  4. Transfer the mixture to the baking pan. Using a flat-bottomed measuring cup, press it evenly into the bottom and to the corners. The mixture may be slightly crumbly.

  5. Sprinkle 1 cup semi-sweet chocolate chips and 1 cup butterscotch chips evenly over the graham cracker layer. Sprinkle 1 cup sweetened or unsweetened shredded coconut evenly over the chocolate and butterscotch chips. Sprinkle the pecans evenly over the coconut. Pour 1 (14-ounce) can sweetened condensed milk evenly over the top to finish. The milk will naturally spread to cover the bars, so there is no need to spread it with a spoon or spatula.

  6. Bake until golden brown, 25 to 30 minutes. Place on a wire rack and let cool completely, 1 to 2 hours. Grasping the excess parchment paper, lift the slab out of the pan and place on a cutting board. Cut into 20 bars.

Recipe Notes

Storage: Store the bars in an airtight container at room temperature for up to 3 days or freeze for up to 3 months.