This post may contain affiliate links. Please read our disclosure policy.
Make this decadent gluten free dairy free chocolate cake with a ‘secret ingredient' that makes it a super tender, without any added butter or eggs, or any dairy-free substitutes.
The secret ingredient in this chocolate cake that replaces eggs and butter is mayonnaise, which is just a stable emulsion made of eggs and oil, and is naturally dairy free. But whether you love or hate mayo, you won't taste it at all in this cake, so it stays a secret.

Why this recipe works
I don't like to bake too much with neutral oils like canola and vegetable oil, since they tend to create an oily-tasting cake in larger amounts. Baking with mayonnaise allows us to bake without any dairy substitutes, but still bake a moist and tender, super decadent chocolate cake that is also dairy-free.
And since this cake doesn't require any nondairy substitutes that you may not already have, you can bake this cake for a dairy free friend without having to buy something special at the store.
If you'd prefer a more “classic” chocolate cake, and you can have dairy, try our one bowl gluten free chocolate cake recipe.


Recipe ingredients explained
Here are a few things to keep in mind about each of the ingredients and what role they play in the finished cake:
- Mayonnaise – Adds all the richness and fat we need, eliminating the need for additional eggs, or any butter replacement. Avoid mayonnaise with added flavors, and use Hellmann's if possible, since other mayos tend to have more pronounced flavors of their own that might shine through more.
- Boiling water – Since this cake is made without melted chocolate in the batter, it relies heavily on cocoa powder for chocolate flavor. To deepen the chocolate flavor, we dissolve the cocoa in boiling water in a process called “blooming.”
- Cocoa powder – Since this cake has baking soda in it to neutralize any acid in your natural cocoa powder, you can use natural cocoa powder or Dutch-processed, or even Hershey's Special Dark cocoa powder, which is a blend of the two.
- Brewed coffee – Deepens the chocolate flavor without adding any detecable coffee taste. You can use decaf or caffeinated coffee, or replace it with more water.
- Sugar – Adds sweetness and tenderizes the cake's crumb.
- Salt – Balances the sweetness and enhances the chocolate flavor.
- Vanilla extract – Vanilla extract is as delicious in chocolate cake as it is in our gluten free vanilla cake, deepening all the other flavors.
- Gluten free flour blend – Any well-balanced gluten free flour blend that is designed to work well to make cakes should work. Just be sure yours has a finely ground rice flour or the cake will be gritty. I like Better Batter's classic blend, Nicole's Best with added xanthan gum, and Bob's Red Mill's 1-to-1 blend here.
- Cornstarch – A touch of cornstarch adds some lightness to the flour blend, for a more tender crumb. If you can't have corn, try using arrowroot or potato starch.
- Baking soda – Helps give the cake lift, and neutralizes acidic ingredients like natural cocoa powder, if you're using it.
Expert tips
Use a light-colored pan
A light colored metal pan will bake most evenly without overbaking. It can be harder to determine doneness in a chocolate cake than a vanilla cake because the dark color will hide any signs of browning in the oven. If you're using a darker colored pan or porcelain or glass, which hold heat especially well, begin checking for doneness by 25 minutes of baking time.
Avoid fat free or lowfat mayo
Fat adds moisture, tenderness and richness to baked goods. Low-fat and fat-free baked goods tend to be rubbery, so use the real mayonnaise with all the fat.
Let your cake cool before frosting
A warm cake will melt your frosting and ruin its texture, even if you refrigerate it after to firm it back up.
Frosting options
I include a dairy-free ganache frosting recipe, including instructions on how to make it into a whipped ganache frosting for this cake. It's super decadent, and not overly sweet, as the only sugar in the frosting comes from the chocolate.
You can also use your favorite dairy free buttercream frosting, or serve this cake without any frosting at all. A light dusting of confectioners' sugar on a completely cooled cake would make a nice touch.

Ingredient substitutions
Egg-free
This cake is made with mayonnaise, which contains eggs and oil in perfect emulsion. I think that vegan mayonnaise would work in its place.
Cornstarch-free
If you need to avoid corn products, make sure your gluten free flour blend is cornstarch-free and replace the added cornstarch with arrowroot or potato starch, or just more flour blend, by weight.
Coffee
Brewed coffee deepens the chocolate flavor, but you can use more boiling water in its place. You can also replace some hot water with more coffee.
Sugar-free
You may be able to make this cake with Lankato brand monkfruit granulated sugar alternative. Alternative sugars tend to dry out a cake's batter, so pay close attention to the texture of your cake batter, and add more hot water by the teaspoonful to match the texture you see in the photos and video on this page.

Gluten Free Dairy Free Chocolate Cake Recipe

Ingredients
For the cake
- ¾ cup (6 fluid ounces) boiling water
- ¼ cup (2 fluid ounces) strong brewed coffee, (See Recipe Notes)
- ¼ cup (20 g) unsweetened cocoa powder, (natural or Dutch-processed)
- 1 ounce dairy-free dark chocolate, chopped (optional)
- ⅔ cup (150 g) mayonnaise, (regular mayo) at room temperature
- ¾ cup (150 g) granulated sugar
- 1 /4 teaspoon kosher salt
- 1 teaspoon pure vanilla extract
- 1 ¼ cups (175 g) all purpose gluten free flour blend, (See Recipe Notes)
- ½ teaspoon xanthan gum, omit if your blend already contains it
- ¼ cup (36 g) cornstarch
- 1 teaspoon baking soda
- 6 ounces dairy-free semi-sweet chocolate chips, optional
For chocolate topping (optional)
- 10 ounces dairy-free dark chocolate, chopped
- ¾ cup (6 fluid ounces) canned coconut cream, (See Recipe Notes)
Instructions
For the cake.
- Preheat your oven to 350°F. Grease and line an 8-inch round or square baking pan. Set the pan aside.
- In a medium-size, heat-safe mixing bowl or measuring cup, place the boiling water and brewed coffee and the cocoa powder, and whisk until well-combined. The cocoa powder will resist combining, so just keep whisking.
- Add the (optional) chopped chocolate, and mix until melted and smooth. Add the mayonnaise, sugar, salt, and vanilla, and whisk until well-combined.
- In a large bowl, place the flour, xanthan gum, cornstarch, baking soda, and about 5 ounces of the (optional) chocolate chips, and mix to combine and coat the chips in the flour.
- Create a well in the center of the dry ingredients, and add the wet mixture. Mix until very smooth and well-combined. The batter will start off very thin, but will thicken a bit as you stir. Keep mixing until that happens.
- Transfer the cake batter to the prepared pan, and smooth into an even layer using a moistened spatula or broad, flat knife.
- Sprinkle the remaining (optional) chocolate chips evenly over the top, and bang the cake a few times on the counter to help the chips adhere.
- Place the pan in the center of the preheated oven and bake for about 30 minutes, or until done. A round cake will be thicker, so it will take a bit longer to bake than a square cake. Begin checking a square cake at 25 minutes.
- Doneness should be determined by a few things: the cake should be puffed and rounded at the edges. It also shouldn’t jiggle when moved back and forth, and a toothpick inserted in the center should come out mostly clean (and certainly not wet).
- Remove the cake from the oven, place the pan on a wire rack and allow to cool completely in the pan. To make it easier to slice, you can chill the cake, still in the pan, in the refrigerator.
For the topping.
- Place the chopped dark chocolate in a small, heat-safe bowl.
- Place the coconut cream in a small, heavy-bottom saucepan and melt over a low flame. Pour the hot cream over the chopped chocolate.
- Allow the chocolate and hot cream to sit, undisturbed, for about 5 minutes before whisking until completely smooth.
- Pour the glaze directly over the cooled cake, and allow it to set at room temperature.
- To whip the chocolate ganache into frosting, allow it to cool at room temperature, then cover and refrigerate it until beginning to set (about 20 minutes).
- Using a handheld mixer or a stand mixer fitted with the whisk attachment, whip the frosting until lighter in color and relatively fluffy (about 3 minutes).
- Frost the cakes as desired, then slice into 9 equal pieces and serve.
Video
Notes
My favorite gluten free flour blends are made with superfinely ground rice-flour that's well-balanced with other ingredients. I recommend Better Batter's original blend, Nicole's Best multipurpose blend with 1/2 teaspoon xanthan gum added, or Bob's Red Mill 1-to-1 (in the blue bag). Bob's isn't my absolute favorite because it has an aftertaste and can make crumbly baked goods, but it's inexpensive and readily available and has improved a lot recently. If you'd like to make your own blend, please see my all purpose gluten free flour blends page. For the brewed coffee.
You can use decaffeinated coffee. You can replace the brewed coffee with more water. For the coconut cream in the topping.
If you don’t have to be dairy-free, use heavy whipping cream in the same amount. If you do use the coconut milk, do not use “light” coconut milk, which is just thick coconut milk with water added. Cake recipe adapted heavily from The New York Times chocolate snack cake. Originally published on the blog in 2021. In 2022, more text and resources added to the post; recipe unchanged.
Nutrition
Nutrition information is automatically calculated, so should only be used as an approximation.
Storage instructions
This cake is moist enough that it will stay fresh on the counter, covered well, for a couple of days. For longer storage, I recommend freezing it.
Make in advance
You can make this cake and cool it, wrap it tightly (unfrosted!) in cling wrap, and store it at room temperature for at least 2 days. Once you frost the cake, it's really hard to wrap it tightly, so it's best to serve it the same day after it's been frosted.
Freezing
For longer storage, wrap this cake tightly in freezer-safe wrap like Glad Press ‘n' Seal. You can freeze it frosted or unfrosted, but it's easiest to store the uncut cake unfrosted.
If you have leftover cake that's already been frosted, slice it into squares and wrap each frosted square tightly on its own, then freeze. Defrost at room temperature, or even in the refrigerator, for a dairy free, gluten free treat any time.
FAQs
Mayonnaise is, indeed, dairy free. There is sometimes confusion about whether mayonnaise is dairy free, presumably since it's so creamy and looks like dairy.
No, this cake is not Paleo, since it's made with a classic rice-based all purpose gluten free flour blend. Rice is not Paleo.
It isn't made with almond flour, either, which has a much shorter shelf life, and is typically very expensive (but worth it, usually!). The best Paleo chocolate cake is, indeed, made with almond flour.
A cake that cracks on the top is usually baked in an oven that's too hot, which caused too much of a quick rise at the start. Many ovens run hot, including mine, so I rely on a freestanding oven thermometer that I replace frequently, to ensure proper baking temperatures.
I haven't tried making cupcakes with this batter, but I think it would work. Fill the muffin tins 2/3 of the way full and check for doneness at about 20 minutes.
More gluten free dairy free desserts
Since I have a section in every post like our “ingredients and substitutions” section above, almost all of my gluten free desserts recipes can be made into gf df desserts. Here are a few other gluten free dairy free dessert recipes you might also want to try:
- Vegan gluten free chocolate chip cookies (they're made without an egg substitute, so they're naturally vegan, and of course dairy free)
- Dairy free gluten free fudge (made with just 3 incredibly simple ingredients: sugar, coconut milk, and unsweetened chocolate)
- Dairy free gluten free white chocolate (made with smooth, creamy cacao butter)
- Dairy free gluten free no churn ice cream (a favorite cold, sweet treat, without any fuss—and never icy!)
- Gluten free dairy free cake (a dairy free vanilla cake with a super-moist crumb and no “vegan butter” needed!)














Thanks for another great recipe! We’ve got an egg allergy, so I swapped the Mayo for a vegan Mayo (Hellman’s) but made no other changes. Eggs can be so tricky to replace, but I’m happy to report that it turned out great!
Oh that’s so great, Lynn, that it worked with Hellmann’s vegan mayo. I didn’t even know they made a vegan mayo. So good to know. Thank you for sharing that!
Delicious! I’ve used mayonnaise in other cakes and it has always been delicious and produces moist cakes. I used dark chocolate and added some peanut butter for grandkiddos. Came out so tasty. I made a simple peanut butter glaze of just water, peanut butter and powdered sugar. Complimented the added peanut butter in the recipe. Thanks for this winner!
I made this exactly as written. Whipped the the ganache into a frosting – wow! It really worked! My husband loved the dessert – suggested I add a mint leaf and cherry as a garnish. Definitely will make this again. A keeper!
Again, I added 10 min cooking time to account for our higher altitude. Thanks again Nicole!!
Haha, Dawn, it is kind of amazing, how you can make a rich chocolate frosting with just 2 ingredients like that. I love the fancy garnishes! Thank you for sharing your high altitude adjustment. And so glad you enjoyed the cake!!
I’m confused about the chopped chocolate. The recipe says to add it to the coffee mixture but then later it says to add it to the dry mixture. I had already added it to the warm coffee. Should there be a required are optional chocolate ingredients?
I think you’re confusing the chopped chocolate (which is optional and gets melted in the hot water) with the chocolate chips (which are also separately optional and get added in the dry ingredients) Emma!
Hi Nicole,
I love your recipes. My wife appreciates them even more. She’s the one who’s gluten/dairy intolerant. I’m the one who makes the recipes. It’s taken me a while to realize that I could only comment on current (or recent) recipes, but I have one now! Would Olive Oil mayonnaise flavor also disappear? That’s what we usually use. But if not, I’ll buy some regular mayo just for this recipe. It looks amazing!
That’s so great, George! And yes, comments close after about 5 or 6 months. But with 2 new recipes every week, there’s always a place to leave a comment. 🙂 Definitely put some “regular” mayonnaise on your shopping list for the next trip. The olive oil mayonnaise (which we like, too) is actually a “light”version under a different name. I don’t recommend using it. I hope that helps!
I am so excited to try this because tomorrow is my close friend’s birthday. She is dairy free and gluten free. (I am too.) Now I can cook her (and myself later when my birthday occurs) a cake for her birthday! Thank you for posting this.
That’s awesome, Leilani! I think you’ll both love the cake. Happy Birthday to her!
Great cake!! I used vegan Mayo and put egg replacer powder with the flour with great success! My non allergic family thought it was great too!!
That’s an interesting swap, Michelle. Eggs are really tricky to replace! Glad it worked well.
Made this yesterday. Easily the best gluten free cake I’ve ever made! My picky teenagers and husband raved about it. I make my own blend of gf flour- mix of cassava, tiger nut, almond and coconut flours, and it worked beautifully. I have shied away from xanthan in the past due to food sensitivities but tried it here wit success and I think it is very key in this recipe. The texture and taste are excellent. Thanks for the recipe!
Hi, Barb, I’m glad you enjoyed it. Please understand that that’s really not an all purpose gluten free flour blend, and it is so different as to create a different recipe. I’m glad you got lucky this time!
I guess the oil and egg yolk in mayo makes it accomplish the same purpose as eggs and fat in the cake recipe. But mayo in cake recipes always weirds me out. I’m so afraid to try it.
I wouldn’t ever post anything that wasn’t great. But there are so many chocolate cake recipes here on the blog, Alene. Try another one!
Do you use the just the cream on top of the canned coconut milk?
Hi, Dre’, Yes, use just the cream! The less water, the better.