Ready for a (shell) shocker? While plain ol’ raw eggs can stay good in the refrigerator for weeks, once cooked, their shelf life takes a rapid nosedive. So, if you’ve boiled up a weekend batch for high protein snacking for days to come, you’ll want to take a closer look at just how long they’ll last.

Read on to crack the code on hard-boiled egg freshness.

According to the U.S. Department of Health and Human Services, fresh, raw eggs can keep in the fridge for 3 to 5 weeks. (You can even keep them on the countertop, though they’ll spoil faster that way.)

Hard-boiled eggs are another story. These last only 1 week in the fridge, and should be refrigerated within 2 hours of cooking.

Accidentally left your hard-boiled babies out while you caught up on a Marvel movie marathon? When in doubt, throw them out. The United States Department of Agriculture (USDA) says the 2-hour window is the max for cooked eggs to sit at room temperature.

As for those times when you’re unsure about whether your hard-boiled snacks are still edible, use your senses to check for signs of spoilage. A funky smell or slimy, chalky texture are red flags that it’s time to toss ’em.

The storage rules for eggs sound like a paradox — shouldn’t cooked foods last longer than raw ones? Not necessarily.

Hard-boiled eggs are more susceptible to spoilage than fresh eggs because the cooking process removes a naturally occurring waxy protective layer from their shells. This layer coats freshly laid eggs, and much of it is washed off when the eggs are graded and packed.

When the eggs are boiled, the water removes the rest. This leaves open pores in the shells for bacteria to enter and contaminate the eggs more easily.

The Food and Drug Administration (FDA) also has some urgent warnings for Easter egg hunters: Don’t eat them after you’ve hidden or played with them.

The rainbow-colored eggs might still be pretty to look at but taking them out in the yard or hiding them on a dusty mantel isn’t a recipe for safety. Doing so could expose them to harmful bacteria that may penetrate into their edible interiors.

Your freezer is a bastion of protection for all sorts of foods, from meats to veggies to frozen pizzas (no judgment). Even fresh eggs can be preserved by freezing. The hard-boiled variety, on the other hand, isn’t an ideal candidate for a stint in the deep freeze.

According to the American Egg Board, freezing whole hard-boiled eggs or hard-boiled whites yields a tough and watery finished product.

If you’d like to try your hand at freezing the hard-boiled yolks, though, have at it. Simply hard-boil whole eggs as you normally would (covered on the stovetop for about 12 minutes), let cool, remove the yolks, and package them in an airtight container for freezer storage.

Rubbery whites, dry yolks, grayish color — poorly cooked hard-boiled eggs are a sad, sad thing. Fortunately, the perfect hard-boiled eggs are relatively simple to master.

This easy recipe (hint: a timer is involved) turns out fab results every time. All you need is a little determination and a lot of vigilance. Get the perfect hard-boiled egg recipe, then check out the tutorial below for a step-by-step visual.