An egg can float in water when its air cell has enlarged sufficiently to keep it buoyant. This means the egg is old, but it may be perfectly safe to use. Crack the egg into a bowl and examine it for an off-odor or unusual appearance before deciding to use or discard it. A spoiled egg will have an unpleasant odor when you break open the shell, either when raw or cooked. (Source: USDA/FSIS)

How to cook eggs safely

Proper cooking as well as proper storage is important for egg safety. Cook eggs thoroughly so both yolks and whites are firm, not runny. Casseroles and dishes containing eggs should be cooked to 160° F as measured by a food thermometer. Do not eat raw or undercooked eggs. Once eggs are hard-cooked, they should be refrigerated (in their shells) within 2 hours of cooking and used within a week. Refrigerate them in a clean container, not their original egg carton.

For more information on eggs, see:  https://food.unl.edu/cracking-date-code-egg-cartons