Magic bars are layered with sweet chocolate, coconut, and crunchy pecan flavors, and they couldn’t be easier to make. This gluten-free version is perfect for sharing at potlucks, picnics, and parties!

Chewy, sweet, and crunchy. Magic bars are called ‘magic’ for a reason. This dessert has everything: sweet coconut, melty chocolate, crunchy nuts, a tender crust, and it can be prepped and baked in under 30 minutes. This gluten-free version is perfect for gatherings where food sensitivities are a concern, but it’s been a favorite on this site for over a decade because it is a hit even with those for whom eating gluten isn’t a concern.
These quick and easy bars are the perfect dessert for super busy home cooks that need a sweet treat for a crowd, and don’t have time to make a batch of chocolate chip cookies. To make this recipe, you only need to press the easy coconut flour crust into a baking pan, layer the chocolate in, sprinkle the coconut and nuts, and then pour thick, rich sweetened condensed milk over the top.
If you love desserts that travel well, and are perfect for everything from casual bake sales to festive parties, then magic bars are just the treat you’ve been looking for.
What are magic bars?
Magic bars get their name for the “magical” layers of flavor in this addictive cookie bar. Typically, recipes will include: sweet coconut, bitter-sweet chocolate, sweetened condensed milk (which give the cookies a caramel flavor), crunchy nuts, graham cracker cookies, and rich butter.
Magic bars also go by 7-layer bars or dolly bars. Recipes for 7-layers bars also include butterscotch chips. There are so many fun variations of this easy dessert, which adds to the fun of making (and eating) these wonderful snacks.
How to Make
- Preheat the oven to 350 degrees F, and prep the baking pan.
- In a mixing bowl, stir together the ingredients for the crust. Press the crust into the bottom of the pan.
- Top the crust with chocolate chips, then pecans and coconut. Pour the condensed milk evenly over the bars.
- Bake the bars just until the coconut is golden brown, 20 to 25 minutes.
- Let the bars cool completely before slicing.

Ingredients
- Coconut Flour, Light Brown Sugar, Kosher Salt, Unsalted Butter - Pantry staples that you’ll need to make the crust.
- Semi-Sweet Chocolate Chips - Semi-sweet chips have a bitter-sweet taste that is just the right amount of sweet. Milk chocolate chips work too, but will give you a sweeter seven layer bars.
- Shredded Sweetened Coconut - Be sure to use sweetened shredded coconut, which is moister than unsweetened coconut.
- Pecans - Chopped pecans add a nutty crunch to the bars. You could also use walnuts or almonds.
- Sweetened Condensed Milk - An unassuming ingredient that does some heavy lifting in this recipe by binding the ingredients together, and producing a sweet, caramel-like taste in each bite.

Tips
- To make removing the bars from the pan easier, grease the 8x8 baking dish with butter and line with parchment paper.
How to store
Storing chocolate coconut bars in the refrigerator will help these dessert bars maintain the perfect consistency for cutting into squares. You can either keep them in the baking pan, and cover tightly with plastic wrap, or place them in an airtight container. Enjoy within 5-7 days.
Variations
- Try different mix-ins - Marshmallows, peanut butter chips, butterscotch chips, and chopped dates add their own unique layers of flavors. Chop your favorite candy bars up and add them for a decadent mix-in.
- Make them salty and sweet - Chopped gluten-free pretzels make an amazing salty-sweet 7-layer bar.
- Drizzle with butterscotch - Layer magic bars achieve another level of, well, magic, when you drizzle them with butterscotch before serving.
FAQs
This cookie bar recipe freezes really well. Slice the magic cookie bars and place them in an airtight container. If you stack the bars in the container, use a piece of parchment paper to separate the bottom layer from the top layer. This will prevent them from sticking together.
When slicing magic bars, a good rule of thumb is to refrigerate the bars before slicing. When you bake the magic bars, all of the delicious ingredients will melt together to create the perfect 7-layer bar. An hour or two in the refrigerator will firm up the melty chocolate and sticky sweet coconut just enough to make clean slices.
More Dessert Bar Recipes
- Pumpkin Cheesecake Bars
- Fourth of July Cookie Bars
- Chocolate Chip Oatmeal Cookie Bars
- Peanut Butter Cup Cookie Bars
- Pink Lemonade Bars
- Caramel Apple Cheesecake Bars
Favorite Tools

Creamy Chocolate Coconut Magic Bars {Gluten-Free}
Equipment
- 8x8 baking pan
- Mixing Bowl
- Parchment Paper
Ingredients
- ½ cup coconut flour (see note)
- ⅓ cup light brown sugar
- ½ teaspoon kosher salt
- ¼ cup unsalted butter, melted
- 4 large eggs
- ¼ teaspoon almond extract
- 1 ¼ cups semi-sweet chocolate chips
- ½ cup chopped pecans (optional)
- 1 ¼ cup shredded sweetened coconut (see note)
- 1 cup sweetened condensed milk
Instructions
- Preheat the oven to 350 degrees F. Grease an 8x8 baking dish with butter and line with parchment paper (this will makes it easy to pull the bars out in one piece when they finish baking).
- In a large mixing bowl, whisk together the coconut flour, light brown sugar, and salt. Add the melted butter, eggs, and almond extract all at once and stir with a wooden spoon until evenly combined.
- Spread the batter out in the prepared pan until even. Bake until it just begins to set, 8 minutes.
- Remove the crust from the oven and sprinkle the chocolate chips evenly over the top. Top with pecans and coconut. Drizzle the sweetened condensed mil in even stripes across the coconut.
- Return the bars to the oven and bake just until the coconut is golden brown, 13-15 minutes.
- Let the bars cool completely before slicing.
Notes
Nutrition
Allison
These look amazingly delicious!!! I miss your food!
Alyssa {Suitcases & Sweets}
I am definitely pinning these. They look fabulous! And lucky for your blind Thai teacher, I bet they taste just as amazing as they look. 😉
Jess
You, friend, have the most incredible memory of ANYONE. My Thai teacher has a serious sweet tooth and a sense of smell like you wouldn't believe!
Liz
Thank you for the lovely recipe. Love the combination of ingredients. Have a wonderful day.
Jess
Thanks so much, Liz. Coconut and chocolate just work!
Karista
I love, I love, I love! It's early morning here and I wish I had one of these for breakfast. 🙂 Think I'll be making these this weekend. Thanks Jess!
Jess
Coconut counts as a breakfast food, Karista, so I'd totally be in support of one of these first thing in the morning. 😉
sally @ sallys baking addiction
Yes, chocolate is a cure all. It's just a guaranteed "make me feel better' indulgence. And these coconut layer bars would make me feel 100% again. Good luck continuing to learn Thai, Jess! I could never do it!
Averie @ Averie Cooks
Jess I love these!! I saw them on FG and I am a huge fan of 7 layer bars/hello dolly/magic bars and layered bars in general and these are right up my alley. Pinned!
Jess
Me too, Averie! I completely forgot how much I love 7 layer bars until I made these and immediately wanted them to be topped with sweetened condensed milk. Will definitely need to be making more 7 layer bar variations in the future!
Claire @ Claire K Creations
Ooh nom nom nom!!! I've been experimenting with coconut flour recently too.
Well done to even learning a little bit of Thai. It sounds so complicated.
Jess
It's SO complicated, Claire. Sheesh. You are my coconut flour inspiration - can't wait to see what you come up with!
Holly @ EatGreatBEGreat
These sound awesome! Love the fact that they're gluten free! Pinned!
Katie (The Muffin Myth)
Oh, I hear you on the language classes, lady. I just finished 14 weeks of Saturday morning Swedish classes, and I am not sad they're done (for now). I can't even imagine learning Thai! These bars are reminiscent of a graham cracker crumb crusted 'gooey square' my family loves to make. The condensed milk makes everything so caramelly and delish. I haven't played with coconut flour yet, but this looks like the perfect intro. Thanks for another amazing recipe!
Jess
Mmmm, gooey square? That sounds fantastic - the condensed milk really does work magic on desserts. I am so impressed with you, Katie - finishing school, starting a full time job, AND taking Swedish classes!?
Maria
These look so amazing! I'm gonna try these over my "cheat weekend" 🙂 I was in Thailand for 5 years, but I don't think I remember any of my Thai... (maybe just the anthem hehe) I wish I had you in my class with these!
Erin @ The Emerging Foodie
Oh my goodness, I think I'm going to have to make these ASAP, too! So good.
Liz
These look so wonderful Thank you, Jess.
Erin @ The Emerging Foodie
Hey Jess! Question. I want to make these this weekend for a church group I'm going to on Thursday night... do you know if they'll stay good that long (Sunday to Thursday)? Or could I freeze them?
Jess
Erin - these keep really nicely, so I think they'd be just fine if you made them now for thursday. I've definitely kept them around for 3 days and they've still been great. Store them in the fridge, but the the coconut flour base isn't the type that would dry out over a few days.
https://www.lyricsmv.com/
Wow, incredible weblog layout! How long have you ever been running a
blog for? you made blogging glance easy. The overall
look of your website is magnificent, as smartly
as the content!
Katarina
Made these last night and they were FANTASTIC! I couldn't find coconut flour so I made them with all-purpose and halved the eggs. I was a little worried but they turned out great. Exactly what I was craving!
Ashley
Quick question I'm in love panang curry do you have any authentic recipes for that?? My second fav is coconut bars I'm soo makin these:)
Jess
Hi Ashley - I hope you liked the bars! My favorite panang curry recipe is actually a soup, but it's not your classic panang - https://www.inquiringchef.com/2010/12/01/potato-panang-soup/. However, panang curry is absolutely my favorite type of curry as well!
Debi
Could I use coconut milk in place of the sweetened condensed milk?
Jess
Hi Debi - I'm quite late to reply to this comment, but I did want to let you know that, unfortunately, you probably will not have luck with coconut milk in place of the sweetened condensed. Sweetened condensed milk will caramelize in the oven, but coconut milk will likely saturate the bars. However, if you did try this - let me know how they turned out!
christine
i made this recipe a few days ago and everybody loved them!
i substituted 1/2 of the brown sugar with coconut palm sugar, and the coconut flour with Pamela's GF baking flour, since I had that on hand. I also used several types of chocolate chips--some semisweet, some dark.
Turned out very yummy! Thanks so much for sharing!! 🙂
Jennifer Kochan
Hi there-
Can you substitute coconut sugar for the brown sugar? If so, would the measurements be the same?
Jess
Hi Jennifer, I've never tried this substitution, but I suspect it will work. I'd use the same measurements, since there are a few other elements that give this sweetness. Let me know how they turn out!
Joanna
Hi there!
Can I substitute almond flour for coconut?
Thanks!
Jess Smith
Hi Joanna - I've never tried it, but I think it should work fine!
Robin
Hi,
I loved the gluten free version. I can't find it. Help!!!
Robin
Jess Smith
Apologies Robin! I just sent you an email, but if you don't get it, just send me a note at jess@inquiringchef.com and I'll send you the old version. We recently made some updates to this recipe!