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!)














Aren’t there eggs in mayonnaise? If so, then this cannot be labeled as a dairy free dessert
Eggs are not dairy, Gail. This is, indeed, a dairy free dessert. Just do a google search and you’ll see that thinking that eggs, and/or mayonnaise, is dairy is a common mistake.
For clarification, is the dark chocolate sweetened or unsweetened? Thanks!
It is not unsweetened. The only time to ever use unsweetened chocolate in any recipe is when it’s specifically called for.
In Mexico the mayo including Hellman’s has lemon flavoring. is there a better substitute?
No, without mayonnaise, you can’t make this particular recipe. I have many other cake recipes and no other uses mayo so have a look around.
I’ve been eating chocolate mayonnaise cake for 60 years as I think it developed popularity during WW2 and my mom would bake it for everyone’s birthday. Haven’t had any since I became gluten intolerant 10 years ago. Thanks for giving me back my very favorite chocolate cake and decades of wonderful memories!
Oh wow, Nadine, that’s amazing! I didn’t grow up with it, but I wish I had. I hope you enjoy it and thanks for sharing!
I can’t use any gf flour blends because of sensitivities to all of the starches in them, potato, tapioca, cassava and corn. What do you suggest? I am trying to make my own gf flour blend… but what flours are the most similar to the Better Blend?
I have the same problem with your bread recipes. Help!
Thanks
I’m afraid you can’t make any of my recipes or any of my all purpose flour blends without starches, Joan. You might do better with a Paleo recipe site?
I never baked a cake before and this one was bomb. 🤘
That’s awesome, Tyro! Hopefully it’s the first of many cakes in your future. :)
A triumph for us gluten-free diary free campers! One hour ago I took it out of our portable Coleman oven that sits on top of our 20,000Btu Camp Chef outside propane stove. Delicious! I’m always looking for less delicate offerings and for my husband’s health I use 1/2 sugar and 1/2 swerve! I’ve had camping success with many of your recipes. Thank you so much, Nicole.
That’s so awesome to hear, Lucinda! Camping success is definitely a special kind of success, I imagine. :) Good to know that you were pleased with the cake made with half Swerve, so thanks for sharing that.
Beyond delicious! I will never understand the magic of mayo or boiled water. As always, your recipes are the best of the best!
Haha, Jeanne, so true! I just try to appreciate them and let them work their magic. 🪄
I was totally confused when I read your comments about the recipe being egg-free, given it has mayonnaise in it. But that’s because I had no idea you can get egg-free mayo! Who knew? I look forward to trying it out when my grandson comes, as he has an egg allergy and often misses out when it comes to cakes.
Oh it’s not egg free, Wendy! I said it doesn’t have added eggs, as in additional eggs as an ingredient. As I explain in the post, I haven’t tried this recipe myself with egg-free mayo, but others have and have reported success so it’s definitely worth a shot!
My mistake, Nicole! I must have read “dairy-free” and had brain freeze! But. I’ll certainly try an egg-free mayonnaise and see how it turns out.
Could it be baked in cupcake liners?
I’m honestly not sure how this recipe would turn out baked as cupcakes. I don’t generally like to use the same recipe for cake as for cupcakes, except when I’m using a DIY cake mix, as they generally don’t turn out as well when used interchangeably. Sorry I can’t be of more help, Sandra!