As an egg ages, the yolk moves more freely and can become displaced as the white thins out. Using fresh eggs will reduce the chance of having off-centered yolks, but fresh hard-cooked eggs are hard to peel.
To have centered yolks in eggs that are still easy to peel, use eggs that have been refrigerated for a week to 10 days. Researchers have also found that eggs stored on their sides have the most consistently centered yolks. Secure the carton of eggs closed with a rubber band, and turn the carton on its side in the refrigerator for up to 24 hours before cooking.