Butter and Milk
Many frostings are made with butter and milk. These frostings need to be refridgerated and because of the ingredients, these frostings tend to spoil faster. According to WhatsCookingAmerica.net, buttercream frosting that uses milk and butter can be stored for a couple of weeks in the fridge. In a sealed container it may last even longer. All homemade frostings can be frozen and thawed for use later. Make Fabulous Cakes says that buttercream frosting will store in a sealed container in the freezer for six months. Simply thaw and whip for use after freezing.
Shortening and Oil
Frostings that are made with shortening and no milk can be stored out of the fridge. WhatsCookingAmerica.net says that non-refridgerated frostings will keep for two weeks in a sealed container. Without a lid their life will shorten considerably because the air will dry them out. Humidity plays a large role in all things baking. Frosting is no exception. If you store homemade frosting outside of the fridge, how long it will last depends on humidity levels. If humidity is high the frosting container could build up excess moisture which will eventually ruin the frosting. Or, if it is too dry, the frosting could simply harden and become unusable.
The average shelf life of any type of frosting is a couple of weeks. Elements to consider when storing homemade frosting include the ingredients (butter and milk will spoil faster when left outside the fridge) and humidity.
References and ResourcesMake Fabulous Cakes: Buttercream Frosting
Whats Cooking America: Buttercream Icing