This post may contain affiliate links. Please read our disclosure policy.
Make this decadent gluten free dairy free chocolate cake without any dairy-free butter or milk substitutes for a cake that's designed to be made without dairy. It's rich in chocolate flavor, stays fresh at room temperature for days, and is even tender when chilled.

Why this recipe works
This rich chocolate cake doesn't call for any nondairy substitutes that you may not already have, so you can bake it for a dairy free friend without having to buy something special at the store. Plus, the flavor of vegan butter can have an artificial taste due to added culturing agents.
Since this cake was originally made with mayonnaise instead of a combination of an egg and oil, it's easily adapted to being made with vegan mayonnaise for an egg-free, dairy-free cake with deep cocoa flavor.
Recipe ingredients
Here are a few things to keep in mind about each of the ingredients in this cake and what role they play in a successful result:

- Boiling water: Water of course adds moisture to bring the cake together. We use boiling water to dissolve the cocoa in boiling water in a process called “blooming,” which deepens the chocolate flavor.
- Cocoa powder: Adds lots of rich chocolate flavor. 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 noticeable coffee taste. You can use decaf or caffeinated coffee, or replace it with more water.
- Dairy free chocolate: Adds more chocolate flavor and creates a fudgier, more dense and rich texture. You can use vegan chocolate disks or chopped chocolate. Be sure to use melting chocolate that is made for baking, and avoid chocolate chips which contain added wax to prevent them from melting in the oven.
- Egg: Adds structure, some lift and keeps the cake from falling as it cools.
- Oil: Adds fat for richness and mouthfeel, and keeps the cake moist for longer at room temperature and even when chilled.
- Sugar: Adds sweetness and tenderizes the cake's crumb by locking in moisture.
- Salt: Enhances the other flavors.
- Vanilla extract: Vanilla extract is as delicious in chocolate cake as it is in vanilla cake, deepening all the other flavors. Use vanilla bean paste for extra flavor.
- Gluten free flour blend: Any well-balanced gluten free flour blend that is designed to work well to make cakes should work, as long as it has finely ground rice flour or the cake will be gritty. I like Better Batter's classic blend, Bob's Red Mill's 1-to-1 blend with an additional 1/8 teaspoon xanthan gum (the blend has some gum but not enough), or Vitacost's Multi-Blend gluten free flour with added xanthan gum as listed in the recipe. Avoid Nicole's Best here, since it contains dairy.
- Baking soda – Helps give the cake lift, and neutralizes acidic ingredients like natural cocoa powder, if you're using it.

How to make gluten free dairy free chocolate cake (step by step photos)
This visual guide demonstrates how to make this cake in your own kitchen and includes an explanation for each step. For the exact ingredient amounts and instruction, please see the recipe card below.
Make the hot chocolate mixture
In a 4 cup/950 ml heat-safe measuring cup or medium-size bowl, whisk boiling water, hot brewed coffee and 1/2 cup cocoa powder. The cocoa powder will resist combining so keep whisking until it's smooth.
Add chopped dairy free chocolate to the hot mixture and whisk it in so it melts, then let the mixture sit for 5 minutes so the cocoa powder blooms, or develops its full flavor potential.


Add the remaining wet ingredients
The chocolate mixture should be warm, but no longer hot, so it's cool enough enough that it won't cook the egg when you add it. Add an egg, oil, sugar and vanilla. Whisk vigorously to emulsify the egg, oil and water together into a stable mixture that ensures even moisture distribution in the cake. This creates a glossy mixture that won't turn greasy.


Whisk the dry ingredients
In a large separate mixing bowl, whisk together gluten free flour, xanthan gum, salt and baking soda to avoid any pockets of leaveners.
Combine wet and dry ingredients
Create a well in the center of the dry ingredients and pour in the wet ingredient mixture so you can incorporate them together gradually, decreasing mess and creating a more uniform batter quickly and easily.


Finish the cake batter
Whisk together the dry and wet ingredients. As you mix, it will turn smooth and glossy. Make sure to scrape the bottom of mixing bowl to incorporate any dry patches into the batter.
If you'd like to add chocolate chips, you can mix in up to 4 ounces of dairy free chocolate chips now using a spatula. You can also scatter up to 1 ounce more on top of the raw cake after transferring it to the pan.


Transfer the batter
Scrape the batter into a lined baking pan, and smooth it into an even layer with a small spatula. The batter will be thick enough to spread, but not so thick that spreading is difficult.
Bake the cake
Bake at 350°F until the cake is rounded at the edges, and a tester inserted in the center comes out with moist crumbs attached, at most. If the tester comes out wet but you're concerned you may overbake the cake, reduce the oven temperature to 325°F or even lower until done.
Cool in the pan
Let the cake cool completely in the pan while it rests on a wire rack. The cake is so moist that, if you try to turn the cake over onto a wire rack and remove the pan before it's completely cool, it will stick to the rack.


Expert tips
Avoid olive oil
Olive oil has a distinct fruity and earthy flavor that will compete with the chocolate flavor of this cake. Any neutral oil without any flavor of its own will work though. Try canola, vegetable, grapeseed, avocado, or peanut oil.
Try canned dairy free frosting
I love the taste of shelf stable frosting in the can, and many of them are gluten free and dairy free. Miss Jones brand canned frostings are gluten free and dairy free; so are many Pillsbury and Duncan Hines frostings, but always read labels to be sure. To give canned frosting more of a homemade consistency, attach one beater to a handheld mixer, insert it in the can, and beat until smooth before using to frost the cooled cake.
Don't skip the coffee
Brewed coffee deepens the chocolate flavor and we use so little that you really don't taste it, so I recommend using it even if you don't like the taste of coffee. You can also double down on the coffee and replace some more or all of the hot water with more coffee. Espresso granules dissolved in the boiling water should also work well.
Ingredient substitutions
Egg free
You can try using a 150 grams of a vegan mayonnaise in place of the egg and oil, or try an egg replacer like Bob's Red Mill Egg Replacer, a chia or flax egg, or JustEgg liquid egg replacer (in the refrigerated case).
Oil
This recipe was originally developed to use mayonnaise in place of oil and eggs. I found that the crumb of the cake was too fragile, so I reworked it for a cake made with 2/3 cup of oil and 1 egg. The result is a more tender cake with a crumb that's still very moist but less fragile. If you'd like to avoid using oil as an individual ingredient, though, you can replace the oil and the egg with 2/3 cup (150 grams) full-fat mayonnaise at room temperature.
Coffee
If you want to avoid coffee altogether, you can use more boiling water in its place. Decaffeinated coffee works just as well. Keep in mind that chocolate and cocoa powder also add some caffeine.
Chocolate
You can't leave out the cocoa powder and chocolate to make this into a vanilla cake, but if you'd like, you can leave out the chocolate as a separate ingredient. The cake will have a more mild chocolate flavor and will be overall less rich. For a vanilla version, try our vanilla-flavored gluten free dairy free cake.

Storage instructions
This cake is moist enough that it will stay fresh on the counter, covered well, for a couple of days. Wrap the cooled and unfrosted cake tightly in plastic wrap, and store it at room temperature for 3 to 5 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 frosting.
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 in the refrigerator.
Gluten Free Dairy Free Chocolate Cake Recipe

Ingredients
For the cake
- ¾ cup (6 fluid ounces) boiling water
- ¼ cup (2 fluid ounces) strong brewed coffee, hot (See Recipe Notes)
- ½ cup (40 g) unsweetened cocoa powder, (natural or Dutch-processed)
- 2 ounces dairy-free chocolate, discs, or chopped
- 1 (50 g out of shell) egg, at room temperature (See Recipe Notes)
- ⅔ cup (150 g) neutral oil, vegetable, canola, peanut, grapeseed, and avocado all work (See Recipe Notes)
- ¾ cup (150 g) granulated sugar
- 1 teaspoon pure vanilla extract, or vanilla bean paste
- 1 ¼ cups (175 g) all purpose gluten free flour blend, (See Recipe Notes)
- ½ teaspoon xanthan gum, omit if your blend already contains it
- 1 /4 teaspoon kosher salt
- 1 teaspoon baking soda
For chocolate frosting (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 square or 9-inch round 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 chocolate discs or pieces to the hot mixture and whisk until melted and smooth. Let the mixture sit for 5 minutes to deepen the chocolate flavor.
- To the chocolate mixture, add the egg, oil, sugar, and vanilla, and whisk until smooth and well-combined.
- In a separate large mixing bowl, place the flour blend, xanthan gum, salt, and baking soda, and whisk to combine well.
- Create a well in the center of the dry ingredients, and add the wet mixture.
- Whisk until very smooth and well-combined. Keep whisking until the batter begins to thicken.
- Transfer the cake batter to the prepared pan, and smooth into an even layer using a spatula or broad, flat knife.
- Place the pan in the center of the preheated oven and bake for about 30 minutes, or until done.
- 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).
- Place the cake pan on a wire rack and allow it to cool completely in the pan. If you've used mayonnaise instead of an egg and oil, chill the cake pan in the refrigerator for about 30 minutes for cleaner slices.
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 over a low flame just until melted and then simmering. 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.
Notes
I recommend Better Batter's original all purpose blend, Bob's Red Mill 1-to-1 (in the blue bag) with an additional 1/8 teaspoon xanthan gum (it contains gum but not enough), or Vitacost's Multi-Blend Gluten Free Flour with added xanthan gum. Nicole's Best doesn't work here because it contains dairy. If you'd like to make your own blend, please see my all purpose gluten free flour blends page. About the brewed coffee
You can use decaffeinated coffee. You can also replace the brewed coffee with more water. Egg and oil
In place of the egg and oil, you can use 2/3 cup (150 grams) regular, full fat mayonnaise. I can only recommend Hellmann's brand regular mayonnaise. Avoid anything flavored, any sort of light mayo, or mayo made using olive oil (which is really just light mayo by another name). The cake will rise a bit less and be a bit more fragile.
Nutrition
Nutrition information is automatically calculated, so should only be used as an approximation.
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. It's a stable mixture of egg and oil.
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.














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.