About 3 to 5 weeks.
Raw eggs in their shells keep about 3 to 5 weeks in the refrigerator from the day you buy them, according to the USDA. The sell-by date may pass in that time, and the eggs are usually still fine.
Store them in their carton on a shelf, not in the door. The door is the warmest part of the fridge and swings in temperature every time it opens. The carton also keeps eggs from picking up odors and losing moisture.
To check an egg, set it in a bowl of water. A fresh egg lies flat on the bottom. An older egg tips up or stands on end because its air cell has grown. If it floats, it's very old, and many cooks toss it. The surest test is to crack it into a bowl: an off smell means it goes in the trash.
Hard-boiled eggs keep about a week in the fridge, and raw eggs out of the shell, beaten, can be frozen for up to a year.