Eggs turn green because of a simple chemical reaction between sulfur in the egg white and iron in the yolk. When heat drives these two elements together, they form a compound called ferrous sulfide, which has a greenish tint. This is most commonly seen as a dark green or grayish-green ring around the yolk of a hard-boiled egg, but it can also appear in scrambled eggs and other preparations.
What Causes the Green Ring
Egg whites contain sulfur-based proteins. When you apply heat, those proteins break down and release hydrogen sulfide gas, the same compound responsible for the “rotten egg” smell. Meanwhile, the egg yolk is rich in iron. As cooking continues, the hydrogen sulfide migrates inward from the white toward the yolk. When it meets the iron at the yolk’s surface, the two react to form ferrous sulfide, a greenish-gray compound that settles right along the boundary between white and yolk.
Two factors control how much ferrous sulfide forms: temperature and time. The longer an egg cooks, and the hotter it gets, the more sulfur gas is released and the more pronounced the green ring becomes. A perfectly cooked hard-boiled egg can have little to no green at all. An egg that’s been boiling for 20 minutes will almost certainly have a visible ring.
Is It Safe to Eat?
Yes. The green color is purely cosmetic. Ferrous sulfide is actually the same form of iron found in over-the-counter iron supplements, according to food scientist Stephanie Smith at Washington State University. It doesn’t change the nutritional value of the egg in any meaningful way. It can, however, give the egg a slightly more sulfurous taste, which some people notice and find off-putting. If you’re making deviled eggs or anything where appearance matters, preventing the green ring is worth the effort, but there’s no health reason to toss a green-tinged egg.
Scrambled Eggs Can Turn Green Too
The same reaction isn’t limited to hard-boiled eggs. Scrambled eggs cooked at too high a temperature or held too long on a steam table (common in hotel breakfast buffets and cafeterias) can develop a greenish cast across the entire surface. The USDA notes this is the same sulfur-iron reaction, just spread more evenly because scrambled eggs are broken up and have more surface area exposed to heat. If you’ve ever seen slightly green scrambled eggs at a buffet, that’s why. They sat under heat for too long.
Cooking scrambled eggs in a cast iron pan can intensify the effect. Cast iron contributes extra iron to the equation, giving the sulfur even more to react with. If your scrambled eggs consistently look grayish-green, switching to a stainless steel or nonstick pan may solve the problem.
How to Prevent It
For hard-boiled eggs, the goal is to cook the yolk through without overdoing it. Place eggs in a single layer in a pot, cover them with cold water by about an inch, and bring the water to a full boil. Then remove the pot from heat, cover it, and let the eggs sit for 10 to 12 minutes. This residual heat cooks the yolk gently without pushing the temperature high enough to trigger a heavy sulfur reaction.
What you do after cooking matters just as much. Transferring the eggs immediately into a bowl of ice water stops the cooking process and halts the chemical reaction before ferrous sulfide has time to form. Let them sit in the ice bath for at least five minutes. Skipping this step is one of the most common reasons people end up with green yolks even when their cooking time was reasonable, because the egg continues cooking from its own retained heat.
For scrambled eggs, cook them over medium or medium-low heat, stirring frequently, and pull them off the burner while they still look slightly underdone. They’ll finish setting from residual heat on the plate. If you’re serving them buffet-style, keep the holding temperature as low as possible and make smaller batches more frequently rather than letting one large batch sit for an extended period.

