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.

Chocolate frosted chocolate cake in square baking pan with one piece missing

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.

Fork with chocolate crumbs on white plate with rest of chocolate frosted chocolate cake partially eaten

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.

Chocolate frosted chocolate cake in baking pan with one piece missing and one square piece cut
Go Ad-Free

Gluten Free Dairy Free Chocolate Cake Recipe

5 from 50 votes
Prep Time: 20 minutes
Cook Time: 35 minutes
Setting time for frosting: 20 minutes
Yield: 9 slices
This gluten free dairy free chocolate cake is rich in chocolate flavor with a soft, tender crumb and a rich chocolate frosting.
Save this recipe!
Get this sent to your inbox, plus get new recipes from us every week!
Please enable JavaScript in your browser to complete this form.

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

Flour blend 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

Serving: 1slice | Calories: 649kcal | Carbohydrates: 64g | Protein: 6g | Fat: 42g | Saturated Fat: 21g | Polyunsaturated Fat: 8g | Monounsaturated Fat: 10g | Trans Fat: 0.1g | Cholesterol: 9mg | Sodium: 508mg | Potassium: 464mg | Fiber: 7g | Sugar: 32g | Vitamin A: 34IU | Vitamin C: 1mg | Calcium: 45mg | Iron: 6mg

Nutrition information is automatically calculated, so should only be used as an approximation.

Like this? Leave a comment below!

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

How is this cake dairy free when it has mayonnaise?

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.

Is this cake Paleo?

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.

Why did my cake crack on top?

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.

Can I make cupcakes with the same cake batter?

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:

About Nicole Hunn

Hi, I’m Nicole. I create gluten free recipes that really work and taste as good as you remember. No more making separate meals when someone is GF, or buying packaged foods that aren’t good enough to justify the price. At Gluten Free on a Shoestring, “good, for gluten free” just isn’t good enough!

Leave a comment

Your email address will not be published. Required fields are marked *

Recipe Rating





This site uses Akismet to reduce spam. Learn how your comment data is processed.

51 Comments

  1. Aravna J Clerveus says:

    Good

  2. Tricia says:

    Can you make this cake into a 2 layer cake?

    1. Nicole Hunn says:

      You should be able to do that, Tricia. The crumb is softer than my classic gluten free chocolate cake, though, so it might be a little more difficult to slice as a layer cake, though. If you don’t have to be dairy free, I’d go with that cake, which I know works beautifully as a layer cake. If you need this one, though, just chill the cake layers before you assemble and then even before you slice it. That should make it work. I hope that’s helpful!

  3. Lisa says:

    Unfortunately I need to make this cake with Grandpas Kitchen Flour. I am baking for my recently diagnosed 9 year old grandson. I’ve bought all the special ingredients and despite going to 4 different stores (including two google assured me have better batter) I can’t find it. Or the other one. No time for delivery from Amazon .I need to make the dairy free gluten free cake today. Just wondering before I start if you would lessen the amount of corn starch in the recipe since Grandpas contains cornstarch and your review of this flour says it is too starchy? Thanks for your opinion and recipe. Your directions and explanations are so nice and thorough for a first timer.

    1. Nicole Hunn says:

      I’m afraid I’m not familiar with that blend, Lisa, so I can’t begin to guess at what you might be able to do to make it a better experience. Instead of baking with a gluten free flour blend, maybe you’d prefer a flourless chocolate cake or my recipe for quinoa chocolate cake, which is made with cooked quinoa as a base, no flour. My flourless recipes are designed to be made by someone who doesn’t have time to order a good gluten free flour blend and still wants to bake something delicious.

  4. Lisa says:

    I’m getting ready to make this. Can I double the recipe and make a sheet cake (not Texas sheet), like a 8×13 pan?

    1. Nicole Hunn says:

      I haven’t tried this as a doubled recipe in a large baking pan, but my concern is that the center tends to burn before it’s baked all the way through to the ends. You can try it, but I would instead recommend doubling the batter then dividing it equally among 2 pans and baking them separately.

  5. Elaine Everitt says:

    Wondering if I can make this in a bundt pan or would I have to double the recipe.
    Thanks!

    1. Nicole Hunn says:

      I’m really not sure that this cake is firm enough to hold up to being baked in a bundt pan, Elaine. But if you’d like to try you’ll have to do some math. An 8-inch cake pan typically holds about 8 cups of batter, and a bundt pan 11 or 12 cups of batter. So you’ll have to increase the yield of the cake to 1.5 times for 12 cups of batter. But depending on the size of your pan, that might be a bit too much batter. It will take some experimentation!

      1. Elaine Everitt says:

        Thanks for your quick reply, Nicole! Looks like I’ll need to make 2 8″ rounds for this birthday cake. Also, just to let you know, I’ve been following you, buying cookbooks and recommending your recipes ever since you published your first cookbook. Kudos to you!

      2. Nicole Hunn says:

        You’re so welcome, Elaine, and I’m so grateful for your loyalty and patronage all these years. It’s been a long time since that first cookbook in 2011. We’re old friends by now!! ❤️