Pesto does not last long once it is opened or homemade. As a practical rule, homemade pesto should be refrigerated and used within 4 days or frozen for longer storage. Opened store-bought pesto should be refrigerated and used according to the label, which is often within a few days to a week depending on the product.
The reason is simple: pesto is usually made with fresh basil or other herbs, garlic, nuts, cheese, and oil. That combination tastes fresh and rich, but it is also perishable. Oil on top can help reduce browning and air exposure, but it does not make homemade pesto shelf-stable or override safe storage time.
If pesto smells sour, rancid, fermented, musty, or “off,” throw it away. Also discard pesto with mold, bubbling, a swollen lid, unusual separation, slimy texture, or an opened jar that was left out too long. Do not taste questionable pesto to see if it is still good.

Quick answer: how long does pesto last in the fridge?
Homemade pesto: Refrigerate and use within 4 days, or freeze it for longer storage.
Opened refrigerated store-bought pesto: Follow the label. Many opened refrigerated pestos should be used within a few days to a week.
Opened shelf-stable jarred pesto: Refrigerate after opening and follow the jar’s instructions. The printed date usually applies to the unopened jar, not the opened jar.
Pesto mixed into cooked pasta or leftovers: Refrigerate promptly and use within 3 to 4 days.
Frozen pesto: Best quality is usually within 3 to 6 months, though continuously frozen food stays safe longer if kept at 0°F.
When in doubt, use the shortest safe timeline. Homemade pesto, fresh deli pesto, pesto from a farmers market, and pesto from a jar with unclear storage directions should be treated more cautiously than sealed commercial pesto from a regulated grocery shelf.
Pesto shelf life chart
| Pesto type | Storage method | How long it lasts | Notes |
|---|---|---|---|
| Homemade pesto | Airtight container in the refrigerator | Use within 4 days | Fresh herbs and garlic in oil need refrigeration and quick use. |
| Opened refrigerated store-bought pesto | Refrigerator | Follow label; often a few days to a week | Use the product label as the final rule. |
| Unopened refrigerated pesto | Refrigerator | Until the printed date if kept cold | Do not store refrigerated pesto in the pantry. |
| Unopened shelf-stable jarred pesto | Cool pantry | Until the printed date if sealed and undamaged | Refrigerate after opening. |
| Opened shelf-stable jarred pesto | Refrigerator | Follow label; often within several days | The unopened pantry date no longer applies after opening. |
| Pesto pasta leftovers | Shallow airtight container in the refrigerator | 3 to 4 days | Use the shortest-lived ingredient in the dish as the guide. |
| Frozen pesto | Freezer-safe container, bag, or cubes | Best within 3 to 6 months | Quality declines over time, especially fresh basil flavor. |
| Home-canned pesto | Not recommended | Do not home-can pesto | Freeze homemade pesto instead. |
For the safest homemade-pesto guidance, treat pesto like fresh herbs and garlic stored in oil: refrigerate it, label it, use it within 4 days, or freeze it. A layer of olive oil on top can help protect color and flavor, but it does not extend the safety window indefinitely.
Why pesto spoils quickly
Pesto is usually uncooked. Traditional basil pesto includes fresh basil, garlic, pine nuts, Parmesan or similar cheese, olive oil, and salt. Variations may include walnuts, spinach, arugula, parsley, lemon juice, roasted peppers, sun-dried tomatoes, or other fresh ingredients.
That ingredient mix creates three storage problems. Fresh herbs bruise and oxidize. Garlic and herbs in oil need careful refrigeration. Nuts and oil can turn rancid and pick up stale flavors. Cheese and added vegetables can shorten the storage window even more.
Commercial pesto may include acidification, preservatives, heat processing, modified atmosphere packaging, or other controls that homemade pesto does not have. That is why a sealed jar from the grocery store can last longer than a homemade batch, but only until it is opened and handled.
How to store homemade pesto in the refrigerator
Homemade pesto should go into the refrigerator right away. Do not let a bowl of fresh pesto sit on the counter while pasta boils, guests arrive, or dinner waits. Put away the extra portion first, then serve what you need.
- Use a clean, dry jar or airtight container.
- Spoon in the pesto and press out air pockets.
- Smooth the surface with a clean spoon.
- Add a thin layer of olive oil on top if desired to reduce browning.
- Cover tightly and label with the date.
- Refrigerate at 40°F or below.
- Use within 4 days or freeze it.
Use a clean spoon every time. Do not dip bread, pasta utensils, or used tasting spoons back into the jar. Crumbs, saliva, pasta water, and dirty utensils can contaminate pesto and shorten its life.

How to store store-bought pesto after opening
Store-bought pesto varies. Some jars are shelf-stable until opened. Some containers are refrigerated from the start. Some deli pestos are made fresh and may have a shorter use window. The label always wins.
- Refrigerate after opening: Once opened, jarred pesto should go in the refrigerator unless the label says otherwise.
- Keep the rim clean: Wipe the jar rim before replacing the lid so the jar seals cleanly.
- Use clean utensils: Do not dip used knives, spoons, or pasta tongs into the jar.
- Do not rely on the unopened date: A “best by” date on the jar usually applies before opening.
- Check the label: Some brands specify “use within 3 days,” “use within 5 days,” or “use within 7 days” after opening.
If the jar lid pops unexpectedly, the jar looks swollen, the product fizzes, or the pesto smells fermented or rotten, discard it. Do not taste it.
Can you freeze pesto?
Yes. Freezing is the best way to keep homemade pesto longer than a few days. It preserves the sauce safely and makes it easy to portion pesto for pasta, soup, sandwiches, chicken, fish, vegetables, and sauces.
The flavor will be brightest in the first few months. Basil flavor, garlic intensity, and fresh color can fade over time, so label the pesto and use it while it still tastes fresh.
How to freeze pesto in cubes
- Spoon pesto into an ice cube tray or silicone portion tray.
- Add a thin film of olive oil on top if desired.
- Freeze until solid.
- Pop out the cubes.
- Move cubes to a freezer bag or airtight freezer container.
- Press out air, label with the date, and freeze.
Small cubes are useful because you can thaw only what you need. One or two cubes can season soup, pasta, scrambled eggs, roasted vegetables, or a sandwich spread without thawing a whole jar.
For freezer storage ideas, see our guide to the best containers for freezing.

Can you vacuum seal pesto?
You can vacuum seal frozen pesto portions for better freezer quality, but vacuum sealing is not a substitute for refrigeration or freezing. Do not vacuum seal fresh pesto and store it at room temperature. Pesto contains fresh herbs and garlic in oil, so it still needs cold storage.
The safest approach is to freeze pesto portions first, then vacuum seal the frozen portions if you want better protection from freezer burn. Keep the sealed portions frozen and label them with the date.
I would not add a vacuum sealer product recommendation to this page. The reader’s main question is how long pesto lasts, and the storage method matters more than a specific machine.
Can you can homemade pesto?
No. Do not home-can pesto. There are no safe home-canning recommendations for pesto. Homemade pesto should be eaten fresh, refrigerated for short-term use, or frozen for longer storage.
This matters because herbs and oil are low-acid ingredients, and garlic-herb mixtures stored in oil can create food-safety risks when they are not handled correctly. Commercial shelf-stable pesto is made under controlled processing conditions that home kitchens cannot simply copy.
For homemade pesto, skip pantry canning. Freeze it instead.
How to tell if pesto has gone bad
Bad pesto is not worth the risk. If it looks or smells questionable, discard it. Do not taste moldy, swollen, fizzy, or foul-smelling pesto.
- Mold: Any fuzzy growth, colored spots, or mold on the surface, lid, rim, or jar means the pesto should be thrown away.
- Sour or rancid smell: Fresh pesto should smell like herbs, garlic, cheese, nuts, and oil. Sour, rotten, musty, fermented, paint-like, or rancid smells are bad signs.
- Swollen lid or bulging package: Pressure, bubbling, or a lid that pops unexpectedly can mean the product is unsafe.
- Fizzing or bubbling: Pesto should not fizz like a fermented drink.
- Slimy texture: A slick, stringy, or slimy surface is a discard sign.
- Unusual separation: Oil separation is normal, but watery liquid, bubbling liquid, or a curdled-looking sauce can signal spoilage.
- Severe browning or blackening: Mild surface browning can be oxidation, but deep discoloration with bad smell, mold, or old storage means it should go.
- Bad taste: Only taste pesto if it looks and smells completely normal. If it tastes bitter, sour, stale, or rancid, discard it.

Is brown pesto bad?
Not always. Pesto can turn dull green or brownish because basil oxidizes after it is chopped and exposed to air. A thin darker surface layer on pesto that was made recently, refrigerated properly, and smells fresh may be a quality issue rather than an automatic safety issue.
However, brown pesto should be handled cautiously. Throw it away if it is old, smells sour or rancid, has mold, is slimy, has bubbling, or has been stored longer than the safe window. If the pesto is black, very dark, or makes you hesitate, discard it.
To slow browning, press plastic wrap directly on the surface, add a thin oil layer, use a narrow jar, keep the jar cold, and limit how often you open it. These steps improve quality; they do not make the pesto safe past the recommended storage time.
How long can pesto sit out?
Pesto is perishable. Do not leave homemade pesto, opened jarred pesto, or pesto pasta sitting out for more than 2 hours. If the room or outdoor temperature is above 90°F, refrigerate it within 1 hour.
For parties, serve a small amount and keep the rest in the refrigerator. Refill the serving bowl with a clean spoon instead of leaving one large bowl out all afternoon.
How long does pesto pasta last?
Pesto pasta leftovers should be stored like other cooked leftovers. Refrigerate them in a shallow airtight container within 2 hours and use within 3 to 4 days.
The pesto itself may be uncooked, but once it is mixed with pasta, chicken, seafood, vegetables, cream, or cheese, the whole dish follows leftover-food rules. Use the shortest safe window for the most perishable ingredient in the dish.
If you reheat pesto pasta, heat leftovers to 165°F. If you prefer pesto cold or room-temperature, only do that with fresh, safely stored leftovers that have not been left out too long. For temperature checks, see our guide to the best instant-read thermometers.

How to thaw frozen pesto
The best way to thaw pesto is in the refrigerator. Move the container or cubes to the fridge the night before you need them. Stir after thawing because oil separation is normal.
- For pasta: Toss frozen pesto cubes directly into hot pasta with a splash of pasta water.
- For soup or sauce: Stir frozen pesto into the hot dish near the end of cooking.
- For sandwiches or dips: Thaw in the refrigerator first, then stir well.
- For best color: Add a little fresh basil, lemon juice, or olive oil after thawing.
Avoid thawing pesto on the counter for hours. If you need it quickly, put the sealed container in cold water and use it as soon as it softens, or add frozen cubes directly to a hot recipe.
How to keep pesto bright green
Keeping pesto bright green is mostly a quality issue, not a safety guarantee. The goal is to limit oxidation and heat exposure.
- Use fresh basil: Wilted basil browns faster.
- Dry the herbs well: Extra water can make pesto separate and spoil faster.
- Add lemon juice: A small amount can help flavor and color, though it does not make pesto shelf-stable.
- Cover the surface: Use a thin oil layer or press wrap directly on the surface before closing the container.
- Use narrow containers: Less exposed surface area means less browning.
- Freeze quickly: Freeze what you will not use within 4 days.
If you make pesto often, a mortar and pestle gives a classic texture, while a food processor is faster. See our guide to the best mortar and pestle for pesto if you want a more traditional setup.

Can you scrape mold off pesto?
No. If you see mold on pesto, throw away the whole container. Do not scrape off the top and keep using the rest. Pesto is moist, oily, and mixed, so visible mold means the container is no longer safe to use.
The same rule applies to a jar rim or lid with mold. If mold grew anywhere on the container or surface, discard the pesto.
Can bad pesto cause food poisoning?
Yes. Spoiled or improperly processed pesto can make people sick. The main everyday risks are spoilage, mold, dirty utensils, and leaving pesto out too long. The more serious preservation concern is botulism risk when low-acid ingredients such as herbs and garlic are stored in oil without proper refrigeration, freezing, acidification, or commercial controls.
That is why homemade pesto should be refrigerated and used within 4 days or frozen. It is also why home-canning pesto is not recommended.
Best containers for storing pesto
The best pesto container depends on how soon you plan to use it. For the fridge, choose a clean airtight container with a small surface area. For the freezer, portion pesto into cubes or thin flat bags.
| Container | Best for | Tip |
|---|---|---|
| Small glass jar | Fridge storage for a few days | Use a narrow jar and a thin oil layer to reduce browning. |
| Shallow airtight container | Short-term leftovers | Press wrap on the surface if there is a lot of exposed pesto. |
| Ice cube tray | Freezing small portions | Freeze solid, then move cubes to a freezer container. |
| Freezer bag | Flat frozen portions | Press pesto into a thin layer, remove air, and label the date. |
| Vacuum-sealed bag | Frozen portions only | Freeze first, then vacuum seal if desired. Keep frozen. |
FAQ
How long does homemade pesto last in the fridge?
Homemade pesto should be refrigerated and used within 4 days. If you will not use it within that window, freeze it in small portions.
How long does store-bought pesto last after opening?
Opened store-bought pesto should be refrigerated and used according to the label. Many opened pestos should be used within a few days to a week, but the exact window depends on the product, packaging, and preservatives.
Can pesto go bad in the fridge?
Yes. Pesto can spoil in the fridge if it is stored too long, contaminated with dirty utensils, left open to air, or kept above safe refrigerator temperature. Mold, sour smell, rancid flavor, bubbling, sliminess, or a swollen lid mean it should be discarded.
How long does pesto pasta last in the fridge?
Pesto pasta leftovers usually last 3 to 4 days in the refrigerator when stored promptly in a shallow airtight container. If the pasta includes chicken, seafood, cream, or other perishable ingredients, use the shortest safe timeline for the whole dish.
Can you freeze pesto?
Yes. Freezing is the best long-term storage method for homemade pesto. Freeze it in ice cube trays, small jars, or flat freezer bags, then label with the date. Use within 3 to 6 months for best flavor and color.
Can you leave pesto out overnight?
No. Homemade pesto, opened pesto, and pesto pasta should not be left out overnight. If pesto has been at room temperature for more than 2 hours, or more than 1 hour above 90°F, throw it away.
Is brown pesto safe to eat?
Slight browning can happen from oxidation and is not always an immediate safety issue. However, brown pesto should be discarded if it is old, smells off, has mold, is slimy, has bubbles, or was stored longer than the safe window. When in doubt, throw it away.
Can you add olive oil on top of pesto to make it last longer?
A thin layer of olive oil can help reduce air exposure and browning, but it does not make homemade pesto safe for long storage. Homemade pesto should still be used within 4 days in the refrigerator or frozen.
Can you can pesto at home?
No. There are no safe home-canning recommendations for pesto. Homemade pesto should be eaten fresh, refrigerated briefly, or frozen. Do not try to make shelf-stable pesto in a home kitchen.
Can you eat pesto past the best-by date?
For unopened commercial pesto, the answer depends on the product, storage, and label. A best-by date is usually about quality, but pesto should not be used if the jar is damaged, swollen, leaking, moldy, rancid-smelling, or otherwise suspicious. Once opened, follow the after-opening instructions rather than the unopened best-by date.
Final thoughts
Homemade pesto lasts only a short time in the fridge: use it within 4 days or freeze it. Opened store-bought pesto should be refrigerated and used according to the label. Pesto pasta leftovers should be treated like cooked leftovers and used within 3 to 4 days.
The best storage habit is to portion pesto early. Keep only a small jar in the refrigerator and freeze the rest in cubes or flat portions. If pesto smells sour, looks moldy, bubbles, turns slimy, or makes you hesitate, throw it away.





Because Brock is the tallest member of the team at 6 foot 5 inches, when he’s not thinking about food, he’s eating his favorites: pizza, burgers, tacos and burritos. He's always experimenting with the latest kitchen gadgets and exploring new techniques in the kitchen.