You can substitute coconut oil in just about any recipe that calls for butter. In some cases, especially in baking, the results won't be exactly the same. And coconut oil won't behave exactly the same way butter does when you're working with it. But as long as you know what to expect, there won't be any bad surprises.
Keep in mind that whatever you're making is going to taste like coconut rather than butter. If that's all right with you, you're fine. In desserts, a hint of coconut flavor could be quite nice. Scrambled eggs that taste like coconut might not be for everyone. On the other hand, who knows? Maybe it'll become your signature dish.
Baking With Coconut Oil
Cookies made with coconut oil instead of butter will generally turn out OK, although they'll be a bit more crunchy. That's because butter is 16 to 17 percent water, while coconut oil is pure fat. Less moisture produces a crisper cookie.
If you wanted to be entirely accurate, you could add some liquid to make up for the missing water. So for every cup of butter (226 grams) in the recipe, substitute 194 grams of coconut oil and 36 grams (or a little over 2 tablespoons) of milk.
Recipes that call for melted butter, like bread, quick breads, muffins, and cakes, will be fine. Just make sure the coconut oil is in its liquid form when you use it. This isn't too difficult. If you've ever kept a jar of coconut oil in your house, you know that it has a lower melting temperature than butter: 77 F, to be exact. That means that on a warm day, it'll turn liquid right there in the jar. (Butter melts at 98.6 F, which, conveniently, is the temperature inside your mouth.)
Coconut Oil in Pie Crusts
Where coconut oil won't substitute quite as well is in flaky pastries and pie crusts. A flaky crust comes from separate blobs of fat that create layers in the dough. But because its melting point is 77 F, coconut oil will liquefy in even a slightly warm kitchen.
And a liquid won't form lumps. Instead, it will coat the flour and basically be absorbed by it, giving the dough a grainy consistency rather than a lumpy one.
This isn't necessarily a bad thing. Pie dough made this way is called mealy pie dough, and it's very tender and crumbly. It's good for bottom crusts of custard and fruit pies because it's less likely to get soggy. It just won't be flaky.
The other thing about this type of dough is that it's more difficult to work with. Rolling it out and fitting it into your pie pan can be a real pain. That's because the fat shortens the gluten molecules (that's why it's called "shortening"), making the dough crumbly rather than elastic.
On the other hand, if you keep your kitchen cold, and chill your flour, your bowl, and other utensils, you could make flaky pie dough with solid coconut oil.
Cooking With Coconut Oil
For ordinary cooking, you can use coconut oil anywhere you'd use butter—like for cooking eggs, making grilled cheese sandwiches, and spreading on toast.
Coconut oil and butter both have a relatively low smoke point of around 350 F, so if you're accustomed to heating up some butter in a pan and sauteeing some vegetables, you can use coconut oil in the same way. If your pan gets too hot, it'll start to smoke, just like butter.
Note that coconut oil won't foam in the pan the way butter does because as mentioned, butter contains water but coconut oil doesn't, and it's the water in the butter that foams as it evaporates.
So a good way to check whether the coconut oil is hot enough to saute with is to test it with a drop of water. A droplet of water should sizzle when the oil is hot enough. Just don't use more than a drop of water to test, or hot fat could spatter.