Put the eggs in cold water. If it sinks, it’s a good egg. If it stands up, it’s still good to eat, but if it floats, it’s a rotten egg, toss it away.
Egg shells are porous, and with time, the egg’s liquid evaporates through the porous shell and air enters. That makes the eggs more buoyant, and so the older an egg is, the more it floats.