The short answer
It depends on the cake. A plain cake or one with a sturdy frosting, such as American buttercream, is usually fine after a night on the counter if it was covered and your kitchen was not hot. A cake with cream cheese frosting, whipped cream, custard or fresh cream filling is a different story. After about eight hours at room temperature, those cakes are generally considered unsafe to eat, and the safest move is to throw them out.
What changes in the cake itself
Even when a cake is safe, a night out changes it a little:
- Drying out. Uncovered cake loses moisture to the air. Cut surfaces dry fastest and the crumb can turn firm or crumbly.
- Frosting crusting or softening. Buttercream can form a dry skin when uncovered, or soften and slump in a warm room.
- Flavor shifts. Some cakes taste a bit better the next day, as the crumb settles and moisture spreads. There is more about that in why cake tastes better the next day.
- Condensation. Fondant can turn sticky or shiny if it is moved from a cool place to a humid one.
These are quality issues, not safety issues.
When it becomes a food safety problem
The concern is bacteria growing in perishable ingredients. Cakes with these components are the ones to worry about:
- Cream cheese frosting
- Whipped cream or whipped topping
- Pastry cream, custard, pudding or mousse filling
- Fresh fruit fillings that have been cut
- Cheesecake and other egg-and-dairy desserts
Common food safety guidance is that perishable food should not be left out for more than about two hours, or about one hour in very hot conditions. A night on the counter is well beyond that. Because bacteria that cause illness do not always change the look or smell of food, you cannot reliably judge it by sniffing.
When it is usually fine
An unfrosted pound cake, a bundt cake with a simple glaze, a loaf cake or a layer cake with a stable buttercream will generally hold for a day or two covered at room temperature. The higher the fat and sugar and the lower the moisture, the more forgiving the cake is. Even so, a hot kitchen makes any cake riskier, so use judgment.
How to decide whether to keep it
Ask these questions:
- Does the cake contain cream cheese, cream, custard or other dairy-based filling or frosting? If yes, throw it away after a night out.
- Was the room warm? If so, be more cautious.
- Was it covered? If not, expect dryness at least.
- Any mold, sour smell, slimy filling or weeping? If so, discard it.
If you are serving someone who is more vulnerable to foodborne illness, such as young children, older adults or pregnant guests, err on the side of tossing it.
Leaving a cake out overnight the right way
If you plan to leave a cake out on purpose, perhaps to serve the next morning:
- Choose a stable-frosted or unfrosted cake.
- Cool it fully before covering.
- Use a cake dome or carrier, or tent it loosely with foil.
- Keep it away from heat and sunlight.
For a cake with perishable frosting, put it in the fridge and bring it out for serving. Our overview on whether you can leave cake out has more on how long different cakes keep, and the article on baking a cake the day before covers advance planning.