So it’s a normal Wednesday night and you’re making pasta. You’re sauteing a few cloves of chopped garlic when the phone rings or your dog/partner/roommate needs attention. You lower the heat and get distracted for a bit, leaving the garlic unattended in the pan. When you get back to the kitchen, something weird has happened: the garlic is now a mysterious shade of blue-green.
While it may seem your garlic has fallen prey to a type of botched science experiment typically reserved for comic-book characters, there’s a perfectly reasonable chemical reaction at play. Weirdly, the reaction is connected with the same intense smell we associate with garlic, onions, and other alliums. “The chemical precursors of these compounds start out safely locked away within individual cells in the plant,” writes The Food Lab author Kenji López-Alt in an article on Serious Eats. “As you cut or grate them, they get exposed to each other, where they end up reacting, with the aid of enzymes.”
Harold McGee, author of On Food and Cooking: The Science and Lore of the Kitchen, wrote about this phenomenon in the New York Times. He noticed that when he started frying a puree of raw garlic, onion, and ginger, the entire mixture turned turquoise. McGee also researched Laba garlic, a Chinese pickled garlic that’s a stunning blue-green. He discovered that this is a result of the garlic reacting with acetic acid, the main acid in vinegar. The acid is “effective at breaching internal membranes and mixing the cell chemicals that react together to create the green pigment,” McGee writes. “The pigment itself turns out to be a close chemical relative of chlorophyll, which gives all green leaves their color.”
Essentially, garlic’s color change comes down to temperature, or, as food scientist Dr. Luke LaBorde of Penn State University explains in Epicurious, a shift in pH. Heating garlic, or mixing it with an acid, can cause the blue-green color. LaBorde and López-Alt also note that older garlic is more prone to changing colors, as it will likely have larger stored quantities of the chemical precursors that can cause the pigment change.
It’s perfectly safe to eat blue or green garlic. If you want to avoid it altogether, use the freshest possible garlic you can find and keep it cold until you add it to your pan. Don’t chop garlic along with raw onions, as they also contain those characteristics that can create the blue-green color. Cook the onions first, then add garlic to the pan. If you’re cooking garlic by itself, cook it very quickly at a high heat. Finally, don’t mix raw garlic with an acid before it’s fully cooked.