Butter is the main ingredient in almost all traditional baking recipes, used for breads, brownies, cakes, cookies, cupcakes, quick breads and just about everything else, and most dairy-free recipes will use dairy-free substitutes like oil, soy margarine, or shortening to stand in for butter in a given recipe, sometimes cutting down the fat with pureed fruits such as apples, bananas or dates. For health reasons, many people prefer to use liquid oils such as canola and olive oil in place of butter for dairy-free baking, and while in many cases this will still produce fabulous results, it is also often the case that it cannot stand in for butter on its own.
When to Use Oil and When to Use Margarine
So, when is it okay to use oil, and when is it better to use margarine and shortening?
First of all, to understand how to properly substitute for butter, it is important to understand how butter functions in various baking recipes. In most recipes for cakes, cupcakes, and quick breads, the process of creaming butter with granulated sugar is extremely important to achieving the even-rising, rich, spongy texture that is so definitive of these products. It is during the three to five minutes of beating the sugar into the butter until it is "fluffy" that the sugar granules cut into the butter and aerate the dense fat to give cakes a rich texture and flavor that will also rise.
Baking Cakes Without Butter
It is because of this creaming step that using oil alone in place of butter for cakes and cupcakes instead of margarine or shortening can be problematic. Oils generally work best in recipes that use liquid sugars such as honey, maple syrup, molasses, or other syrups along with baking agents, another solid fat like ground nuts and some sort of emulsifying ingredient such as eggs or egg substitutes, like in this dairy-free carrot cake that uses a combination of ground nuts, oil, egg whites, and pureed fruit to achieve both moisture and lift, without sacrificing texture. Separating eggs, beating the yolks with the sugar or sweetener, and then folding the egg whites into the other ingredients is another great way to give your oil-based cakes and quick breads both richness and lift and allows you to bake without using margarine or shortening.
It is often the case that oil-based vegan and dairy-free cakes that do not use eggs seem a little dense or lack the melt-in-your-mouth richness of those made with butter, but this problem can be remedied by combining oil with some sort of solid fat, such as ground nuts or chocolate.
Baking Cookies Without Butter
Cookies and shortbreads traditionally use butter for richness and density but rely less on butter for the "lift" needed in recipes like cakes. For this reason, cookies are often much easier to make dairy-free, and simply replacing the butter with margarine or vegetable shortening almost always does the trick. Using oil successfully in dairy-free cookie recipes, however, just as with cakes, depends a good deal on the other ingredients present in the recipe. Using oil in recipes with liquid syrups and ground nuts will produce a cookie with a shortbread texture while using oil in combination with egg yolks and either liquid sweetener or granulated sugar will produce a soft and chewy cookie with a cake-like texture. If you choose to use oil and liquid sweetener without eggs, in most cases and depending on the number of dry ingredients you use, you will either produce a thin, crisp cookie or a cookie with a muffin-top texture.
Generally, in cookie recipes and other dense, sweet dessert recipes like pie dough and cobblers, using margarine and shortening is the best choice. The exception to this rule is for baking cookies that do not use baking agents or are meant to be somewhat dense and dry.
Baking Biscuits and Pastries
For rich baked goods that use baking agents or yeast and little or no sugar or sweetener such as biscuits and pastries, using oil really will leave the finished product lacking in both texture and flavor. These recipes are infinitely more successful using soy margarine or shortening than anything else. Combining oil with ground nuts in biscuit or pastry recipes will not allow for the floury bread-like texture that defines these baked goods, and using extra eggs for richness will not allow for the desired dry texture and will produce a somewhat cake-like consistency. Really, oil just does not do these products justice. This is not to say that oil cannot be used in these recipes, but rather that while you may still produce something tasty, it will simply be vastly different from the traditional product than if you had used soy margarine, shortening, or another semi-solid fat that more closely resembles butter.
Unsalted Butter Versus Margarine
Lastly, most baking recipes call for unsalted butter, and all of the soy margarine and shortenings we have come across are not unsalted. To account for this disparity, simply reduce the amount of salt in a given recipe by 1/4 teaspoon per 1/2 cup margarine.
Last but not least: Coconut Oil is really one of the only exceptions to all of the rules listed above. Coconut oil is similar to butter in that it is solid when cold, semi-solid at room temperature, and liquid when heated, and so it works well in pretty much everything, from cookies and cakes to vegetable dishes. It's expensive, so try to buy it at wholesale stores or when on sale.