There are certain desserts that hit you right in the gut with pure nostalgia, and magic cookie bars are one of them. The kind of treat that showed up at every potluck, bake sale, and holiday gathering in a foil-wrapped pan, still warm from someone's oven. This keto version captures every bit of that layered, gooey, coconut-loaded magic with a buttery almond-coconut flour crust standing in for the traditional graham cracker base. Each bar delivers toasted shredded coconut, crunchy pecans, melted dark chocolate, and a thick pour of homemade condensed coconut cream that bakes into a caramelized, chewy layer holding everything together.

The macro breakdown here is tailor-made for keto. Each generous bar delivers 37 grams of fat from coconut cream, butter, pecans, and coconut oil, while keeping net carbs at just 5 grams. That puts fat at roughly 85 percent of total calories, which is deep in the ketogenic sweet spot. The combination of coconut and pecans provides mostly medium-chain and monounsaturated fats, making these bars a satisfying treat that keeps you full rather than spiking your blood sugar.

From a practical standpoint, this recipe was designed for Sunday batch prep. You make one 8x8-inch pan, chill it, slice it into 8 bars, and stash them in the fridge for the whole workweek. They actually taste better after a day or two once the coconut cream layer fully sets and the flavors meld together. Pull one out after dinner, let it sit at room temperature for five minutes, and you have a dessert that rivals anything from a bakery case.

Ingredients (serves 8)

For the crust:

  • 1¼ cups (125g) almond flour
  • 2 tablespoons (14g) coconut flour
  • 3 tablespoons (42g) unsalted butter, melted
  • 1 tablespoon granulated erythritol
  • ¼ teaspoon fine sea salt

For the condensed coconut cream:

  • 1 can (13.5 oz / 400ml) full-fat coconut cream
  • 3 tablespoons granulated erythritol
  • 1 tablespoon (14g) coconut oil
  • 1 teaspoon pure vanilla extract
  • Pinch of fine sea salt

For the layers (in order):

  • 1 cup (80g) unsweetened shredded coconut
  • ½ cup (55g) pecans, roughly chopped
  • 1.5 oz (42g) dark chocolate (85% cacao or higher), roughly chopped

Instructions

  1. Preheat and prep the pan. Set your oven to 325°F (165°C). Line an 8x8-inch (20x20cm) baking pan with parchment paper, leaving a 2-inch overhang on two sides for easy lifting later. Lightly grease any exposed edges with butter or coconut oil.

  2. Make the crust. In a medium bowl, whisk together the almond flour, coconut flour, erythritol, and salt. Pour in the melted butter and stir with a fork until the mixture resembles wet sand and holds together when pressed. Transfer to the prepared pan and press firmly into an even layer using the flat bottom of a measuring cup or your fingers. Bake for 10 minutes until the edges just begin to turn golden. Remove from the oven but leave the oven on.

  3. Prepare the condensed coconut cream while the crust bakes. Pour the coconut cream into a small saucepan over medium heat. Add the erythritol, coconut oil, and pinch of salt. Bring to a gentle simmer, stirring frequently. Reduce heat to medium-low and cook for 8 to 10 minutes, stirring often, until the mixture has reduced by about one-third and coats the back of a spoon. It should look noticeably thicker and slightly golden at the edges. Remove from heat and stir in the vanilla extract. Set aside.

  4. Build the layers. Scatter the shredded coconut evenly over the warm, par-baked crust. Follow with the chopped pecans in an even layer. Finish with the chopped dark chocolate, distributing it across the surface so every bar will get some.

  5. Pour the condensed coconut cream. Slowly and evenly pour the warm condensed coconut cream over the layered toppings. Use the back of a spoon to gently nudge the cream into any dry corners, but avoid pressing down on the layers. You want the cream to seep through the gaps naturally.

  6. Bake until set. Return the pan to the oven and bake for 22 to 25 minutes. The bars are done when the edges are deeply golden, the top layer of coconut is toasted, and the center no longer jiggles when you gently shake the pan. A slight wobble is fine as it will firm up completely during chilling.

  7. Cool and chill. Let the bars cool in the pan at room temperature for 30 minutes, then transfer to the refrigerator. Chill for at least 2 hours, or ideally overnight. The condensed coconut cream layer needs this time to firm up properly so the bars hold their shape when sliced.

  8. Slice and store. Use the parchment overhang to lift the entire slab out of the pan. Place on a cutting board and slice into 8 bars using a sharp knife. Wipe the blade between cuts for clean edges. Store in an airtight container in the refrigerator for up to 5 days.

Nutrition per Serving

Nutrient Amount
Calories ~390 kcal
Fat ~37g
Protein ~6g
Total Carbs ~10g
Fiber ~5g
Net Carbs ~5g

Nutritional values are approximate estimates based on the stated ingredients and may vary depending on specific brands used.

Tips & Variations

Let them chill fully before cutting. This is the single most important step for clean, bakery-worthy bars. If you cut too early, the condensed coconut cream layer will still be soft and the bars will crumble apart. A full 2-hour chill (overnight is even better) transforms the texture from gooey mess to perfectly sliceable. If you are in a rush, pop the pan in the freezer for 45 minutes instead.

Toast the shredded coconut first for deeper flavor. For an extra layer of nutty, caramelized flavor, spread the shredded coconut on a sheet pan and toast at 325°F for 4 to 5 minutes, stirring once, until light golden. Watch it closely because coconut burns fast. Let it cool before layering. This adds no extra carbs but makes the coconut flavor dramatically more complex.

Watch your chocolate choice for hidden carbs. Not all dark chocolate is created equal on keto. Stick with 85% cacao or higher, and read the label carefully. A standard 1.5-ounce portion of 85% dark chocolate has about 8 grams of net carbs total, which gets divided across all 8 bars. If you want even fewer carbs, use sugar-free chocolate chips sweetened with erythritol or stevia, which can drop each bar by another 1 to 2 grams of net carbs.

Swap the pecans for your favorite nut. Walnuts, macadamia nuts, or sliced almonds all work beautifully here with nearly identical macros. Macadamia nuts bump the fat content up even further and give a more buttery, tropical flavor that pairs exceptionally well with the coconut layers. Avoid cashews, which are significantly higher in carbs than other nuts.

Double the batch for serious meal prep. Use a 9x13-inch pan and multiply all ingredients by 1.5. This gives you 12 bars, enough for nearly two full weeks of weeknight desserts. The bars actually improve after a day in the fridge as the flavors continue to develop, and they stay fresh for a full 5 days without any change in texture or taste.

Frequently Asked Questions

Can I use regular sweetened condensed milk instead of making the coconut version?
No, standard sweetened condensed milk contains roughly 22 grams of sugar per tablespoon and would completely blow through your carb budget. The homemade condensed coconut cream in this recipe uses erythritol, which has zero glycemic impact and zero net carbs. It takes only 10 minutes of simmering to achieve a very similar thick, pourable consistency. If you want a shortcut, some specialty brands sell sugar-free condensed milk, but always check the label for maltodextrin or other hidden carb sources that can spike blood sugar despite being marketed as sugar-free.
What can I use instead of almond flour if I have a nut allergy?
For a nut-free crust, substitute the almond flour with an equal weight (125g) of sunflower seed flour. The texture and fat content are very similar, though sunflower seed flour can sometimes turn slightly green when it reacts with baking soda — not a concern here since this recipe uses no leavening agents. You would also need to replace the pecans in the topping layer with pumpkin seeds (pepitas) or extra shredded coconut to keep the recipe nut-free. The macros will shift slightly but remain well within keto range.
How should I store these bars, and can I freeze them?
Store the sliced bars in a single layer in an airtight container in the refrigerator. They keep perfectly for 5 days. For longer storage, wrap each bar individually in parchment paper, place them in a freezer-safe bag, and freeze for up to 2 months. To serve from frozen, move a bar to the fridge the night before or let it sit at room temperature for 15 to 20 minutes. The coconut cream layer thaws beautifully without becoming watery or grainy. Avoid storing them at room temperature for extended periods, as the coconut cream layer softens significantly above 70°F.
How can I make these bars dairy-free for vegan keto?
The only dairy ingredient is the butter in the crust. Replace the 3 tablespoons of unsalted butter with an equal amount of coconut oil, which actually reinforces the coconut flavor throughout the bar. Everything else in the recipe — coconut cream, coconut flour, shredded coconut, pecans, and dark chocolate — is already plant-based. Just double-check that your dark chocolate does not contain milk solids, as many brands in the 85% range are naturally dairy-free, but not all. With this single swap, the bars become fully vegan keto with virtually identical macros.
Why did my condensed coconut cream turn grainy or separate?
This usually happens for one of two reasons. First, the heat may have been too high. Coconut cream should simmer gently, not boil aggressively. High heat causes the fat to separate from the liquid, leaving you with an oily, grainy mixture. Keep the heat at medium-low and stir frequently. Second, some erythritol brands do not dissolve well in fat-heavy liquids. If you notice graininess, try using powdered (confectioners') erythritol instead of granulated, or blend granulated erythritol in a spice grinder for 30 seconds before adding it to the saucepan. The finer crystals dissolve much more readily into the warm coconut cream.