This topic may be basic for some but I think it makes a neat visual demonstration.
An egg has two membranes. The inner membrane encases the white and yolk, the outer membrane lines the shell. When an egg is laid, it cools and a small air sac forms between the two membranes at the large end of the egg.
The egg shell is porous (it has thousands of pores) that allow an exchange of air and moisture. As the egg ages, the air sac, or air cell, becomes larger. So an easy test of the freshness of an egg is how buoyant it is. The older it is, the more air, the more it will float in water.
The photo shows an egg laid yesterday laying at the bottom of the container on its side. The other egg is at least 3 weeks old, found outside. It is completely floating and would not be fit for human consumption at all.
There is a third possibility which I did not have on hand to show. Sometimes you test an egg in water and it stays on the bottom but stands up, instead of laying down. Many times supermarket eggs arrive at your house this way. This means they are not fresh but are still fine to eat. When cracked open into a frying pan the yolk will be flatter and the white less contained.
These not-so-fresh eggs are perfect for any recipes that require hard-boiled eggs. Peeling a freshly laid egg is about impossible. The cooked white sticks to the shell and peels off with the shell leaving your final product unattractive. A not-so-fresh egg has more air between the membranes so when it is time to peel it, the two membranes separate nicely, giving a very smooth, peeled egg.
When we need hard-boiled eggs, we set our fresh ones on the counter for several days to “age” them. (Rule of thumb- one day at room temperature equals one week in the fridge.) Then they will peel better when cooked.
So when in doubt, test your eggs to see if they are still edible. If it touches the bottom at all it is good, if it is off the bottom, not so much. And if it floats at the top, do not eat it in any form.