Garlic turns blue in vinegar due to the sulfur compounds within it reacting with minute traces of copper in the vinegar. This reaction forms copper sulfate, which is a blue or blue-green compound. The garlic is still safe to eat after it has turned blue unless there are other signs of spoilage.

The amount of copper needed to produce this reaction is very small. This amount of copper is frequently found in water supplies, cooking utensils, butter, lemon juice and vinegar. The enzyme in garlic that reacts with the sulfur and copper to form a blue copper sulfate can be deactivated by heating the garlic. Fresh garlic picked before it is fully mature and not properly dried can also turn iridescent blue or green in the presence of acid, such as an allinin derivative. Garlic may also turn green if exposed to a temperature change or sunlight because it starts to develop chlorophyll. During the process of pickling garlic, it may turn green if the salt being used is table salt as opposed to kosher or canning salt. This reaction is caused by the iodine that table salt contains. Pickling garlic can also make natural blue or green pigmentation more visible, depending on the variety and growing conditions.