Eggs float when spoiled, according to Help with Cooking. As an egg ages, the amount of air inside of it increases. At approximately 3 to 4 weeks of age an egg will have enough air in it to float in water, and it is generally considered unsafe to eat.
To properly perform the egg float test, fill a bowl of water to a depth that is at approximately twice the height of the egg, then carefully lower the egg into the water. If the egg sinks and lays flat on the bottom, the egg is very fresh. If it lies on the bottom but at a slight angle, then it is considered to be approximately a week old. By about 3 weeks of age, the smaller end of the egg will sink and touch the bottom of the bowl, but the larger end will be upright. If the egg doesn't touch the bottom of the bowl at all, it is considered spoiled and should be thrown out.