Homemade pesto is delicious but perishable. For safety and quality, refrigerate pesto at or below 40°F or 4°C and plan to use it quickly. Government food safety guidance for perishable cooked and prepared foods recommends conservative storage times that apply to fresh herb sauces as well. FoodSafety.gov and the U.S. Department of Agriculture Food Safety and Inspection Service advise following the same short refrigerated storage windows used for leftovers, because fresh herbs, cheese, and garlic in pesto create a nutrient-rich environment where bacteria can grow.
Why pesto spoils
Fresh basil and other herbs carry moisture and natural microbes that, once blended with oil and dairy, reduce the barrier to bacterial growth. Cheese such as Parmesan brings additional moisture and protein that supports microbes. Olive oil slows surface oxidation and can improve flavor and color, but an oil layer does not eliminate microbial risk. If pesto is left at room temperature or kept in a warm refrigerator, spoilage organisms and pathogens can multiply. The result is off-odors, bitterness, visible mold, and an increased risk of foodborne illness. Vulnerable people including young children, older adults, pregnant people, and those with weakened immune systems are at greater risk from consuming spoiled products.
Safe limits and practical steps
A cautious and evidence-aligned storage recommendation is to consume homemade pesto within three to four days when refrigerated continuously at 40°F or 4°C or below. This mirrors general guidance on leftover foods from federal food safety authorities and university extension resources that treat herb-based sauces as perishable prepared foods. To maximize safety and quality, cool pesto rapidly after preparation, store it in an airtight container, and press a thin layer of oil on the surface to limit air exposure. Always use a clean spoon to remove portions rather than dipping food directly into the container.
If you need longer storage, freezing is the reliable option. Freeze pesto in small portions or ice cube trays for easy use; frozen pesto maintains acceptable quality for several months and eliminates near-term bacterial growth concerns. Thawed pesto should be used promptly and not refrozen.
Cultural and environmental context matters. Traditional Ligurian practice emphasizes making small quantities of pesto to eat fresh, reflecting both flavor and food safety instincts before modern refrigeration. In modern kitchens, refrigeration and freezing extend usability but do not replace good hygiene and prompt consumption. When in doubt, rely on sensory cues as a last check; discard pesto with an off smell, color change, or visible mold. Following conservative, expert-informed storage limits keeps pesto flavorful and reduces the risk of foodborne illness.