Eggs last longer than the carton suggests
Eggs get thrown out early more than almost anything else in a refrigerator, and it's usually because of a date printed on the carton that isn't measuring what people assume it's measuring.
USDA's Food Safety and Inspection Service puts raw shell eggs at three to five weeks in the refrigerator. Not three to five days past whatever the carton says. Three to five weeks, stored properly.
What the date on the carton actually is
Here's the part that surprised us while researching this. On USDA-graded eggs, code dates are optional. Processors print them mainly to rotate stock and manage inventory, and when they do print one, FSIS rules cap how far out it can go.
There are two families of date, and they have different caps. Expiration-style dates, the ones prefixed with "EXP" or "Sell By," can be no more than 30 days from the packing date. Quality-style dates, the "Use by" and "Best before" kind, may not exceed 45 days including the packing date.
So the printed date is a regulatory ceiling on what a processor is allowed to claim, not a prediction of when the egg stops working. Those are very different things, and only one of them is on the carton.
The genuinely useful number is next to it. That three-digit code, the Julian date, is the pack date: the consecutive day of the year, running 001 for January 1 through 365 for December 31, marking the day the eggs were washed, graded, and put in the carton. That's the egg's actual birthday, and it's the only figure on the package that tells you the real age.
The float test is not a safety test
This one probably causes more unnecessary waste than the dates do.
FSIS explains the mechanism plainly. An egg has no air cell when laid; the cell forms as the egg cools, and grows over time as moisture and carbon dioxide escape through the pores in the shell and air moves in. An egg floats once that air cell is large enough to make it buoyant.
Which means a floating egg is an old egg. FSIS is explicit that this indicates poor quality, and equally explicit that it may still be perfectly safe to use. Their instruction is to crack it into a bowl and check for an off odor or unusual appearance before deciding. A spoiled egg announces itself when the shell opens, raw or cooked.
So the float test measures age, not spoilage. Treating it as a verdict throws out a lot of edible eggs. There's a corresponding freshness tell in the other direction: a cloudy white means the egg is very fresh, and a clear one means it's aging.
Two storage details that matter more than the date
Keep them in the carton, in the coldest part of the refrigerator, and not in the door. That's FSIS guidance directly, and it's the practical reason the door is the wrong home for the thing that lives there in most kitchens.
Then the mechanism worth knowing, because it explains why the counter is genuinely bad rather than just suboptimal. A cold egg left out at room temperature can sweat, and that surface moisture helps bacteria move through the shell's pores into the egg. FSIS says refrigerated eggs shouldn't be out more than two hours. Warming and re-chilling isn't a neutral round trip.
Related, and counterintuitive: don't wash eggs at home. FSIS says washing increases contamination risk, because the wash water can be drawn in through the pores. Commercial processors wash at controlled temperatures specifically to prevent that from happening.
Hard-boiled eggs are the short-dated ones
The reversal most people don't expect. Raw eggs in the shell get three to five weeks. Hard-cooked eggs get one week.
FSIS explains why: cooking leaves a thin layer of water on the egg's surface under the shell, and that moisture is a favorable environment for bacterial growth. Refrigerate them within two hours of cooking and use them inside the week.
Raw whites and yolks separated out are shorter still, two to four days. Whites freeze well for up to a year; yolks don't freeze well at all.
One small consolation for the aging carton
If you've got eggs approaching the end of their run and you were going to boil them anyway, that's the right call. As an egg ages, the pH of the white rises from around 7.4 toward 9, which weakens the bond between the outer white and the shell membrane. Older eggs peel more easily. It's the one respect in which the forgotten carton at the back is the better carton.
Savery dates eggs from the day you bought them rather than from whatever the carton says, for the reasons above. The printed date was answering a question about inventory, not about your refrigerator.