Bakers and cake decorators can call on a wide range of frosting options, depending on the task at hand. They range from the dough-like pliability of fondant to the airy delicacy of an Italian buttercream, with any number of textures in between. Ideally frosting will always have the consistency you'd intended for the job at hand, but in the real world this doesn't always happen. You have several ways to thicken a misbehaving frosting, from chilling it to adding sugar, but sometimes a bit of cornstarch offers the easiest solution.
The idea of adding cornstarch to frosting might seem strange, but it's logical enough. Powdered confectioner's sugar, used in many icing recipes, already contains a modest amount of cornstarch to keep it from clumping. Adding more simply improves the recipe's ability to stabilize and incorporate liquids, including the water that's naturally present in butter.
If the icing is softer than you'd like, whisk cornstarch into a tablespoon or two of milk and add it to the bowl of finished icing. Beat it until the cornstarch is incorporated and then let the frosting rest for a few minutes. The frosting will have more body, and should hold its shape better when spread or piped.
It doesn't take much cornstarch. Start with 1/2 teaspoon of cornstarch per cup of sugar in the recipe, and increase that if necessary to 1 teaspoon per cup. If you use more than this, there's a risk you'll be able to taste the starch in the finished icing.
If you know your chosen frosting will be too soft even before you start, you can sift the cornstarch into the sugar called for in your recipe. That way you don't need to add liquid, but still avoid the risk of finding a clump of cornstarch in the icing while you're spreading it.
Buttercream icings are notoriously susceptible to melting and softening on hot days. Adding cornstarch helps make it resistant to heat and humidity, and some recipes add it for exactly that reason.
Cornstarch is a highly absorbent powder when used straight from the box, which is why it's helpful for stabilizing frosting. It's even more powerful when cooked. When moistened and heated, its starches cook and thicken to a gel-like texture, lending body to a sauce or -- in this case -- a frosting.
Cooking the cornstarch has additional benefits. Its "starchy" flavor and powdery texture disappear, making the frosting more pleasant to eat. It also becomes translucent, so it has less impact on the appearance of frosting.
Recipes incorporating cooked cornstarch usually call for it to be dissolved first in cold milk, water or cream. When you heat and stir the cornstarch mixture, it quickly thickens to a gummy, stodgy texture. When you incorporate the thickened and cooled mixture into buttercream, it helps the frosting reach a thick but smooth and spreadable consistency. Commercial cake decorators have access to prepared gel products for the same purpose, but cornstarch is usually the simpler option for home bakers.
Don't add the cornstarch mixture to the frosting until it cools. Otherwise it will soften the butter or shortening, and will -- at least temporarily -- make things worse, rather than better.