How long do hard-boiled eggs stay fresh?

To peel or not to peel? When it comes to hard-boiled eggs, here's what you need to know about keeping them fresh.
/ Source: TODAY

Hard-boiled eggs may be the perfect protein-packed snack. They're also incredibly versatile chopped up into salads or as the base for a delicious platter of deviled eggs.

But, as anyone who's accidentally left a boiled egg sitting out for too long knows, when an egg goes rotten, it's not a pretty sight ... or smell, really.

The absolute best way to tell if your hard-boiled egg has turned is to trust your gut and your nose. If it reeks of sulfur, just toss it. But if you don't trust your sense of smell, here's what you should know about how long hard-boiled eggs usually last.

To peel or not to peel?

Peel hard boiled eggShutterstock

According to the U.S. Food and Drug Administration, hard-boiled eggs in or out of their shells should be consumed within a week after cooking. They don't last as long as raw eggs because during the cooking process, the shell's protective coating is compromised, and the open pores make it easier for bacteria to get inside and contaminate the egg.

One way to make sure any hard-boiled eggs are used up within a week is to write the date on the shell or the carton when you boil them. However, if you buy pre-peeled eggs, you should not wait a full week before consuming them. Always check the expiration date on store-bought goods. For example, the label on a package of Great Day Farms Hard Boiled Eggs advises eating the pre-peeled eggs within two to three days of opening the package.

One exception to the week-long rule is soft-boiled eggs.

"Soft boiled eggs spoil faster," Emily Rubin RD, LDN at Thomas Jefferson University Division of Gastroenterology and Hepatology told TODAY. If you don't eat soft-boiled eggs right after cooking them, it's OK to keep them in their shell and refrigerate them for up to two days. While the whole point of a soft-boiled egg is to have a creamy yolk, Rubin isn't a fan of the technique. "To prevent salmonella, cook eggs thoroughly so that both the yolk and white are firm."

How to store hardboiled eggs

"Hard-boiled eggs should be refrigerated within two hours of cooking and discarded if left out for more than two hours at room temperature," said Rubin. Her recommendation is to leave them in the fridge in their shells for optimal taste and quality, and to only peel them when you're within minutes of eating them.

Don't worry if they're hard to peel. According to the USDA, the harder it is to peel, the fresher the egg was at the time it was boiled.

While it can be tempting to freeze them to make them last longer, hard-boiled eggs in their entirety aren't freezer-friendly. The egg whites become rubbery and take on an unpleasant texture when defrosted. It is possible, however, to freeze cooked egg yolks. If you go that route, the American Egg Board recommends boiling the yolks again, but separately, prior to freezing them.

How to tell if hard-boiled eggs have gone bad

Hard boiled egg cut in half on chopping boardGetty Images

According to Rubin, the best way to tell if hard-boiled eggs have gone bad is to smell them, especially if you know they're about a week old.

"Of course, smell may be hard to determine because hard boiled eggs already have a strong smell," Rubin said. "But basically you want to discard any eggs with an unusual smell." She also strongly advises discarding any discolored eggs, but says you don't have to worry about the green ring around the yolk.

Eggs with a slightly discolored yolk aren't necessarily rotten. Use your sense of smell before discarding. Jillian Lochner / Getty Images

This color comes from a natural reaction between the iron in the egg yolk and the hydrogen sulfide in the egg white. All it really means is that the egg was overcooked. It may be unsightly, but it's not dangerous.

However, if the yolk or egg white have dark brown, black or green spots on them, it may be a sign that they have come into contact with some type of bacteria. They are not safe to consume and should be tossed immediately.