What you see: Just below the papery outer layer, the onion is green
What it is: Most likely, this onion got a little too much sun.
Eat or toss? Eat!
Onions, like garlic, are modified leaves, designed as storage warehouses for the rest of the plant. And while the bulbs aren’t thin and delicate like the leaves we associate with trees, they're still capable of producing chlorophyll, the green pigment key to photosynthesis.
Normally, an onion, typically shielded from the sun by dirt and its papery outer layer, won’t concern itself with photosynthesizing. But if it detects sunlight, it does what leaves are designed to do—it sends in chlorophyll so it can use light to convert carbon dioxide to oxygen and energy.
Sometimes, horticulture professor Irwin Goldman explains, onions can be as much as two-thirds above the ground. That, combined with a loose outer layer that’s letting in some light, is a recipe for greening. Even after harvest, human light sources can prompt greening.
If your onion starts out with a tightly wrapped outer layer, but is still green underneath, it’s possible that excess light, back when it was a wee bulb, caused it to turn green several layers deep. This happened before the outermost layer dried out, lost its green color, and turned into the papery sheath you probably just peeled away. The layer below, the one you're now contemplating, maintained its chlorophyll-tinted look.
A third possibility? Genetics might make a given onion more prone to green flesh.
This onion is still fine to eat, though the chlorophyll could contribute some bitterness. You may be a little worried about this green color if you’re aware that potatoes with green skins are known to contain toxins. That’s true, but it’s particular to potatoes. An onion with some wayward green pigment isn’t packing surprise toxins.
Irwin Goldman. Horticulture professor. University of Wisconsin-Madison
Onion Disease Guide. Seminis. Editors: Kevin E. Conn, Jeffrey S. Lutton, Staci A. Rosenberger.