Mayonnaise is a not-so-secretly risky condiment. Every summer there are warnings about eating that potato salad at the family picnic or lobster roll at the beach that's been sitting out in the sun for hours, for fear of getting sick. You might be feeling brave and take a bite anyway, which begs the question. How long can be mayo be left out of the fridge, really? And what's the shelf life of mayonnaise anyway? Well, it really depends on what kind of mayonnaise you've got on hand, but chances are good it's much shorter than you think.
To be clear, we're not talking about imitation mayo or vegan mayo here. We're talking about the shelf life of real mayonnaise, as defined by the US government (because of course there's a regulation in the United States about what's actually considered to be mayo and what's not). According to the US Food and Drug Administration, in the United States, real mayonnaise needs to be no less than 65 percent vegetable oil, with vinegar, lemon juice, and some type of egg yolk.
It's the inclusion of an egg yolk that makes mayo perishable and notoriously tricky to handle. "Traditionally, mayonnaise is made with raw egg yolks, and therefore carries a slight risk of salmonella infection," explains food scientist Harold McGee in his book On Food and Cooking: The Science and Lore of the Kitchen, adding, "Manufacturers use pasteurized yolks, and cooks concerned about salmonella can now find pasteurized eggs in supermarkets." This raw egg is part of the reason McGee recommends treating mayo, "as a highly perishable food that should be served immediately or kept refrigerated."
Most commercial mayonnaises, like Hellman's Real Mayonnaise or Sir Kensignton's Mayonnaise, are shelf-stable before opening. That's why the bottle or jar can sit unrefrigerated in the supermarket. But once you open it up, you've got to store mayo in the fridge, and Sir Kensington's notes that refrigerated mayonnaise will "be safe to enjoy approximately 2 months after you first open your jar or bottle." So if you've had an open jar of mayo in your fridge for the better part of the year, it's probably time to throw that stuff away.
The perishable nature of mayonnaise is also why you should throw out mayo that's been left out unrefrigerated overnight. It could be totally fine—until you get food poisoning. And, in general, the FDA recommends tossing perishable foods, including mayo, that have been left out at room temperature for two or more hours.
So put that mayo in the fridge and replace it after two months, or just make your own mayo and use it ASAP. Just be smart, and please don't get salmonella from your potato salad.