Garlic oil forms cloudy layers due to the precipitation of compounds, primarily allicin derivatives, that are soluble in oil at higher temperatures but become less soluble as the oil cools. This is a natural process and doesn't necessarily indicate spoilage.
When garlic is infused in oil, various compounds are extracted, including allicin, which is responsible for garlic's characteristic flavor and aroma. Allicin itself is unstable and quickly breaks down into other sulfur-containing compounds. These compounds are generally soluble in oil at higher temperatures, such as during the infusion process. However, as the garlic oil cools down, the solubility of these compounds decreases. This means that they can no longer remain fully dissolved in the oil and begin to precipitate out of the solution. This precipitation manifests as cloudy layers or sediment at the bottom of the jar. The cloudiness is more pronounced when the oil is stored at cooler temperatures, such as in the refrigerator. The type of oil used, the amount of garlic, and the storage temperature all influence the degree of cloudiness. It's important to note that while cloudiness is normal, it's crucial to ensure the garlic oil is prepared and stored properly to prevent botulism.
To minimize cloudiness, you can filter the garlic oil through a fine-mesh sieve or cheesecloth after infusing it. However, remember that filtering doesn't eliminate the risk of botulism if proper preservation techniques aren't followed. Always store homemade garlic oil in the refrigerator and use it within a week, or consider freezing it in small portions for longer storage.