When you buy a carton of eggs at your local food mart, you take it on faith that the eggs are fresh. Generally, that’s the case, though sometimes an egg or two that are past their prime find their way to the market.

Luckily there’s a simple test for determining if any of your eggs have been around longer than advertised. This is also a useful tool for households that consume eggs only on rare occasion.

Take the eggs from the carton (or your fridge if they’ve been there longer than you recall) and carefully lower them into a large bowl filled with water. If any of the eggs float to the surface, that is your clue that they weren’t laid yesterday. In his book “On Food and Cooking,” food scientist Harold McGee explains that “the moment the egg leaves the hen, it begins to deteriorate in important ways.” One of those ways is losing moisture through the shell, which results in a buildup of air between the shell and its contents. It is the accumulation of air that makes older eggs buoyant and likely to float.

This doesn’t automatically mean the egg is bad. Only cracking the shell will determine that.

What it does suggest is that you should arrange eggs in the fridge such that the floaters are the ones used first.

A second, related experiment will tell you whether an egg you find in the refrigerator is raw or has been hard-cooked. Shaking won’t determine this if the egg is fresh.

A better method is to spin the egg as you would a top on a table or counter top. If the egg spins rapidly and remains upright, it is cooked. Its center of gravity is stable.

If the egg spins slowly or wobbles, it’s raw.

If you’re going to perform this test, make sure not to spin the egg close to the edge of the counter — unless you want scrambled eggs on the floor.