How To Make Magic Cookie Bars

(Image credit: Lauren Volo)

This is a supremely easy, wildly versatile, insanely tasty pan-cookie recipe. No one knows exactly when it was created or by whom, but when it was popularized in the late 1960s, it quickly became the recipe moms knew by heart and kids clamored for.

With a handful of pantry staples like canned condensed milk and graham crackers, these bar cookies are crispy, sandy, creamy, gooey, sweet, chocolatey, and nutty. Consider this bar part-candy, part-cookie, and all delicious.

(Image credit: Lauren Volo)

Magic, Five-Layer, or Hello Dolly?

Magic Bars were without a doubt invented sometime after the creation of sweetened condensed milk in the early part of the 20th century. There is also no doubt that this canned milk is the magic ingredient, holding together all the disparate textures and tastes, and giving this cookie a quality that is like no other. Sweetened condensed milk often gets a bad rap when it comes to fancy pastries, but it is a kitchen wonder; it truly conjures a spell that makes these bars work reliably, deliciously, and with the ease of a safe, inexpensive canned product with a great shelf life.

By the late ’60s and early ’70s, the milk manufacturer shared the Magic Bar recipe in many magazines geared to women. Around the same time, or perhaps shortly before, a young girl in Texas perhaps invented it or came across this recipe. Historically, it’s pretty clear that she made it and named her creation Hello Dolly Bars (for the Broadway show, inexplicably) and shared it with local newspapers. The recipe zoomed across the Midwest and many western states. The only distinction between that recipe and the original was that the walnuts were now pecans.

(Image credit: Lauren Volo)

How To Customize Magic Cookie Bars

The order of the layers is important to the recipe and gives the bar integrity. As long as the basic structure stays intact, think of this recipe as a blueprint and have fun making it your own. This recipe has many possible variations, and I’ve listed a bunch.

  • For the crust: Most cookies and crackers will work for the cookie crust, but I would avoid any cookie that is a shortbread (or has a large proportion of butter) since they tend to make a greasy crust. If you like a little saltiness in your sweets, however, try a saltine.
  • Chocolate layer: If you like a chocolate bar with tidbits in it or even a chocolate-covered candy like a meltable toffee, crush that up well and give it a try. Peanut butter; butterscotch; and dark, light, and semi-sweet chocolate chips are all welcome in this layer.
  • Nuts: The nuts on top get roasty and toasty, but feel free to use anything from peanuts to pistachios to top these bars.

How to Freeze Magic Cookie Bars

Magic cookie bars freeze beautifully when fully baked and can be eaten straight from the freezer for a chewier bar or thawed in the fridge for gift-giving. Cool the bars completely, and cut and wrap the bars individually in plastic wrap. Freeze these parcels on a baking sheet until solid and then transfer to a zip-top freezer bag or other airtight container. Thaw the cookies for a few hours in the fridge before serving.

33 Ratings

How To Make Magic Cookie Bars

Makes9 large or 12 small bars


  • Cooking spray

  • 8 tablespoons

    (1 stick) unsalted butter, or 1/2 cup coconut oil

  • 1 1/2 cups

    crushed cookie crumbs, such as graham crackers or a wafer-style cookie (about 5 1/3 ounces)

  • 1 (14-ounce) can

    sweetened condensed milk

  • 2 cups

    baking chips (about 12 ounces), such as semisweet, white, or milk chocolate, or butterscotch, coarsely chopped into 1/4-inch pieces

  • 1 1/3 cups

    toasted or un-toasted flaked or shredded sweetened coconut, or granola

  • 1 cup

    pecans, almonds, peanuts, or other nuts, coarsely chopped



  1. Prepare the pan. Coat an 8- or 9-inch square nonstick metal or glass baking pan with cooking spray. Cut 2 pieces of parchment paper as wide as your pan and leave the pieces as long as the sheet comes (the excess will create handles that you can use to lift the bars out the pan after baking). Lay one piece of parchment in the pan, with overhang on both sides. Tuck the paper into the corners of the pan. Spray the parchment paper in the pan with cooking spray. Place the second sheet on top, positioning it so that the excess parchment covers the other two sides of the pan and is tucked into the corners; set aside.

  2. Heat the oven to 350°F. Arrange a rack in the middle of the oven. Heat to 350°F if you are using a nonstick metal pan, or 325°F if you are using a glass pan.

  3. Make the crust. Microwave the butter or coconut oil in a medium microwave-safe bowl at high power until melted, about 3 (10-second) bursts. Add the cookie crumbs and mix gently with a soft, heat-resistant spatula to coat. Transfer the mixture to the baking dish and pat firmly into an even layer that is about 1/8-inch thick.

  4. Add the condensed milk. Pour the sweetened condensed milk evenly over the crumb mixture (avoid spreading it with a spoon or spatula to maintain distinct layers). It will spread quickly and evenly over the mixture and will not sink in.

  5. Continue with the other layers. Sprinkle the chocolate or butterscotch evenly over the top. Sprinkle the coconut evenly over the chocolate. Sprinkle the nuts over the coconut. Gently pat the mixture down so the surface is even.

  6. Bake the bars 25 to 30 minutes. Bake until the chocolate has melted and the nuts have become a toasty light brown in color, 25 to 30 minutes. The layers will puff up and sink back when cooled. Let cool in the pan until the chocolate has re-solidified, and both the pan and the bars are completely cool, about 1 hour.

  7. Cut the bars. Grasping the overhanging parchment, gently lift the slab onto a cutting board. Carefully remove the parchment paper and discard. With a sharp knife, cut into either 9 large bars or 12 small bars.

Recipe Notes

Storage: These bars will keep in a covered container at room temperature for up to 3 days.

Alternative oils: Coconut oil (not coconut butter) is a terrific alternative to butter in a cookie crust and widely available at most grocery stores.