1. If you run out of baking powder, mix baking soda with cream of tartar.

You want 1 part baking soda to 2 parts cream of tartar; more info here. If you're making a bunch and plan to store it, Smitten Kitchen suggests adding 1 part cornstarch to keep the mixture dry.
2. Mix white sugar and molasses to make brown sugar.

Get the instructions from Joy The Baker.
3. You can substitute regular milk + lemon juice or vinegar for buttermilk.

The acid will curdle the milk a little bit, add tangy flavor, and activate baking soda the same way buttermilk would. Here's how to do it.
4. Finely grind regular sugar with cornstarch to make confectioner's sugar.

You can do this in a blender or a coffee/spice grinder. Cornstarch keeps the sugar from clumping and will make it work properly as a thickener in glazes or icing. Get the instructions here.
For bonus points, America's Test Kitchen suggests sifting the sugar through a fine-mesh strainer after grinding it to get rid of any big grains.
5. Replace baking chocolate with a mix of cocoa powder and butter or shortening.

This also works with semisweet chocolate; you just throw in a little sugar as well.Get the instructions here.
Keep in mind that the swap is a little rough, and might change the final product; there's a good explanation of how it works over at Serious Eats.
6. "Pumpkin pie spice" is just a mix of 5 common spices you probably have already.

That would be ground cinnamon, ginger, nutmeg, allspice, and cloves (and if you're missing one or two of those, no big deal). If you get ambitious and grind your own whole spices, it'll be even more fresh and flavorful. Here's the secret recipe.
7. If you have milk and sugar, you can make your own sweetened condensed milk.

A little butter is optional, but makes the milk even more thick and creamy. Be warned: It will take at least a couple hours for the milk to cook down to the right consistency. Get the recipe here.
Bonus: If you don't even have regular milk but DO have powdered milk, you're still in luck! Try this method.
8. All you need to DIY almond flour is slivered almonds and a blender or food processor.

Be careful to pulse just until the almonds are powdered; otherwise you could go too far and make almond butter. Get instructions at Detoxinista.
You can use regular almonds with skins on if you don't mind a slightly rougher texture (almond "meal" rather than flour).
9. A good blender can also turn popcorn kernels into cornmeal.

Get the full story at Wonderland Kitchen.
10. DIY peanut butter chips just take 4 ingredients to make.

minimalistbaker.com

minimalistbaker.com
This is a little bit more of a rainy day project than a last-minute swap, but it's so cool. And it's nice to have chips that you know aren't full of weird chemicals. Get the recipe at Minimalist Baker.
11. Make your own cake flour by sifting all-purpose flour with corn starch.

Replacing some of the all-purpose with corn starch mimics the lower protein content of cake flour, which is perfect for making finely textured, fluffy baked goods. Get the instructions here.
12. Replace corn syrup with homemade cane sugar syrup.

Corn syrup is useful because it's an "invert sugar" that keeps sweets and baked goods from crystallizing. But if you're fresh out of Karo, you can DIY a non-corn syrup that does exactly the same thing with just sugar, water, and a little cream of tartar and salt.
You'll need a candy thermometer to cook it to the right temperature; otherwise this recipe from The Kitchn is super-simple.
13. Ground flax or chia seeds mixed with water can replace eggs in baked goods.

The texture and flavor won't be exactly the same, but this trick will come in handy over and over if you're a vegan who loves to bake. Get the instructions here.
14. All you need to make self-rising flour is regular flour, salt, and baking powder.

A lot of Southern-style recipes (biscuits!) call for self-rising flour, but chances are it's not worth buying a bag that will then sit around until it goes stale. It's just as easy to mix up your own when you need it. Get the proportions for the mixture here.
15. It's easy to make custom-colored decorating sugar with regular sugar and food coloring.

This way you'll ALWAYS be prepared to have a cookie-decorating party, which is how it should be. Here's how to do it.
Source: buzzfeed.com