Throw Away Pesto Immediately If You Notice This
When basil is abundant in the summer, making pesto is a great way to utilize the fragrant herb. But how long will your pesto usually last? Unopened, refrigerated packages can last one to three weeks, according to Eat By Date. For canned or shelf-stable products, four to six weeks is the limit if unopened. However, once either of these is unsealed, they should be used within a week or two. Homemade pesto has the shortest shelf life of all and should be consumed within five days to a week.
The condiment can go bad fairly quickly due to the olive oil and high oil content of pine nuts used to make it (via Can it go bad?). These ingredients can go rancid before the other components. It's important to be sure your pesto is not expired or rotten, and you can double-check before eating and see if it's showing any clear signs it has gone bad.
If you see mold, throw it out
The first step if you're questioning your pesto is the sniff test. The pesto should smell like fragrant basil, but if you smell anything sour or rotten it's time to ditch it (via Can It Go Bad?). If it smells fine, there are a few other things you can look for.
Sometimes, it can be hard to tell when pesto has passed the point of no return. The condiment may occasionally turning brown if exposed to heat or air, according to All Recipes, so it might be difficult to visually assess whether or not it's expired. While noting the discoloration is a good place to start, the biggest red flag is something else. No matter how good your pesto smells, throw it away immediately if you see mold or anything growing in it (via Does It Go Bad?). Overall caution is advised, so trust your intuition: If you think the pesto has gone bad, just throw it away.