First and foremost, it is imperative to mention that the greenish yolks of hard-boiled eggs are safe to eat. Regardless of how green the yolk may appear, experts deem the discoloration a mere result of a chemical reaction between the egg yolk and white.

According to experts, this reaction will most likely only occur when you boil an egg for too long as the sulfur and iron compounds react on the surface of the yolk, creating unsightly discoloration as well as a chalky texture. Alternatively, this may happen if there's a high iron content in your cooking water.

Elisa Maloberti, director of product marketing at the American Egg Board, says:

"The discoloration is due to the formation of ferrous sulfide where the yolk and white meet. It's formed when iron from the yolk reacts with hydrogen sulfide from the white."

While this doesn't make the eggs any less safe for consumption, if you are especially uncomfortable with the sight of a greenish yolk, because say, you're a food photographer, then all you have to do is to stop overcooking your eggs!

The fail-safe method of cooking your eggs just right is the one approved by the American Egg Board. Here's the recipe:

Use a saucepan that will hold the eggs in a single layer, and add enough cold water to cover them by about 1 inch.

Heat the pan over high heat until the water is just boiling, then immediately turn off the heat.

Cover the pan, and let the eggs sit to finish cooking (medium eggs will take about nine minutes, large eggs about 12 minutes).

If you're serving them warm, simply drain and peel. If otherwise, run cold water over the eggs until they are completely cool to stop the cooking process.

Did you also know that scrambled eggs can turn green?

Although less heard of, scrambled eggs turn green too, and it is caused by a reaction similar to that previously discussed. According to the American Egg Board, the discoloration also doesn't pose any harm to you. However, it occurs when you're cooking in a cast-iron skillet that can cause the iron in the pan to react with the sulfur in the egg whites.

To avoid this, use a stainless steel or non-stick pan to scramble your eggs. You may also add a drop of lemon into your egg mixture; you only need about 1/8 teaspoon for every 12 eggs.

Now, you have the fail-safe methods for getting perfectly boiled eggs every time!