Fungus Gnats in Indoor Herb and Vegetable Pots: What to Do When You Eat the Plant
Quick answer: To get rid of fungus gnats in herb and vegetable pots, start with the watering: the extension sources say to let the top inch or two of soil dry between waterings and to catch adults on sticky cards, and then to give it several weeks. If that is not enough, they move on to treating the larvae in the soil. For anything you apply to a plant you will eat, read the exact product label for that crop and any wait before harvest.
Tiny dark flies drifting up from a basil pot are a common indoor-growing annoyance, and a worrying one when the plant is dinner. The extension pages we read on fungus gnats are written for houseplants or commercial greenhouses, not for pots you cut herbs and greens from.
This guide sticks to what university extension services say, and it tells you plainly where they disagree or say nothing about edible plants. The byline explains their advice. It is not a report of our own experiments.
In this guide: Are they fungus gnats? | Why they show up | Do they hurt what you eat? | What to do first | Traps | Treating larvae | Seedlings | Keeping them out | FAQ
Are they really fungus gnats?
University of Minnesota Extension describes adult fungus gnats as slender, dark-colored flies about 1/16 to 1/8 inch long. UMass Extension describes the larvae as white and legless with a shiny black head, about 1/4 inch long when mature.
A yellow sticky card is an easy first check. Colorado State University (CSU) Extension suggests placing yellow sticky cards underneath the plant canopy, and Wisconsin Extension says to use them to trap adults. If small dark flies stick to the card, fungus gnats are likely. Our reading: other small flies can land on yellow cards too, so finding larvae in the mix, for example with the potato test below, is the firmer check.
To look for larvae, CSU Extension suggests pushing 1/4-inch slices or wedges of raw potato into the mix. UC IPM says to lay raw potato chunks cut side down. CSU’s IPM page says larvae move to the potato within about 24 to 48 hours. Treat this as a detection test only. None of the sources say a potato controls gnats.
If the pests you see are not tiny flies at all, or the plant looks sick with no obvious cause, our guide to finding the cause by symptom can help you narrow it down. Speckled leaves with fine webbing instead of flies point to spider mites; see our guide to spider mites on indoor herbs and vegetables.
Why they show up in pots
The recurring theme is moisture. CSU Extension says the main reason fungus gnats are abundant in homes is changes in moisture levels. Wisconsin Extension calls them insects commonly associated with overwatered houseplants. University of Maryland Extension says overwatering indoor plants feeds the fungi that the larvae eat.
They also arrive with new things. NC Cooperative Extension (Beaufort County) says fungus gnats typically enter homes through contaminated potting soil, newly purchased plants, or open doors and windows. Purdue Extension and NDSU Extension both mention plants brought in from outside. CSU Extension says nuisance problems tend to be most noticeable in late fall and winter, and Wisconsin Extension says fall is often when problems start, as plants come in.
Our guides on moving a container garden indoors for winter and how often to water container vegetables cover the watering side in more detail.
Do they hurt the plants you eat?
Sources disagree here, so it helps to see both views.
- Little or no harm: University of Maryland Extension says they are annoying but harmless and do not significantly damage indoor plants. University of Minnesota Extension says they typically do not harm plants, although they can be a nuisance.
- Harm to seedlings and weak plants: NC Cooperative Extension (Beaufort County) says established plants typically suffer little harm, but seedlings and plants with weak root systems can have stunted growth. UC IPM and Utah State University Extension make a similar point about seedlings and young plants. Purdue Extension says larvae can spread fungal diseases when they feed on roots.
On people, the sources agree. CSU Extension says adults do not bite or feed, and UC IPM says adults do not damage plants or bite people. University of Minnesota Extension says fungus gnats do not harm people.
Step by step: what to do first
This is the order the extension sources generally give. Nothing here puts a product on a plant you will eat.

- Confirm with a sticky card. Put a yellow card in or beside the pot so you can tell whether the numbers change over the next weeks.
- Let the top of the mix dry between waterings. The depth varies by source: NC Cooperative Extension (Beaufort County) says the top inch, CSU Extension says the top 1 to 2 inches, and NDSU Extension says the top two inches. University of Maryland Extension says larvae die when the soil dries. NC Cooperative Extension (Lee County) adds that the soil should not dry so far that plants wilt.
- Empty saucers. NC Cooperative Extension (Lee County) advises draining saucers.
- Consider bottom watering. NC Cooperative Extension (Beaufort County) suggests watering from the bottom rather than the top. Treat it as an option, not a rule.
- Clear the surface. CSU Extension notes that larvae feed on leaves resting on the mix, so pick up fallen leaves. CSU’s IPM page also suggests repotting when the mix is holding too much moisture, and removing containers with a lot of decaying plant matter, such as decayed bulbs and roots.
- Keep it up for several weeks. CSU Extension and Wisconsin Extension both say the life cycle from egg to adult can take three to four weeks. Our reading: that is why a single dry week is unlikely to clear them, because eggs and larvae already in the pot keep turning into adults. Give new watering habits several weeks before you judge them.
Iowa State Extension says insecticides are not necessary, though CSU Extension says they may be if the problem persists several weeks after watering is adjusted.
Traps and what they can’t do
Yellow sticky cards catch adults. CSU’s IPM page says traps alone will not significantly reduce a population, because the larvae in the mix keep producing new adults. Use them alongside the watering changes.
A coarse sand or fine gravel layer on top of the mix is another idea. Wisconsin Extension suggests a 1/2 to 1 inch layer. UConn Extension, writing about greenhouses, says a layer does not prevent adult females from laying eggs. We would call the evidence mixed, and none of these pages comment on pots of edibles.
Treating larvae when you eat the plant
If the watering fixes have not been enough, the sources move to treatments aimed at larvae in the mix. This is where plants you eat need extra care, because the pages we read are about houseplants or commercial greenhouse crops. None of them say a treatment is fine on herbs or home-grown edibles, and none give a waiting time before harvest for a home pot.
Bti drenches. CSU Extension says larvae may be killed by the microbial insecticide Bacillus thuringiensis subsp. israelensis, known as Bti. University of Maryland Extension says it is the active ingredient in soil drench products labeled for indoor plants. UC IPM says Bti at labeled rates gives temporary control and is toxic only to fly larvae, and that Bt labeled for caterpillars is not effective against fly larvae. NDSU Extension says multiple applications may be needed. CSU Extension says Bti formulations sold for fungus gnat control are generally unavailable through retail outlets, and CSU’s IPM page says Bti is used in commercial greenhouses and large interior spaces. Wisconsin Extension says Bti products are available to homeowners, and Maryland Extension says to look in garden centers or online.
Because the extension pages stop short of edibles, the safest approach is to read the exact product label for the crops it lists and any wait before harvest. Labels differ on which crops they cover. We do not give a waiting time, and we do not name products or give amounts. Follow the label. UC IPM’s “toxic only to fly larvae” describes which insects it affects. It is not a statement about use on food plants.
Nematodes and predatory mites. Some sources list live predators as an option. CSU Extension and UConn Extension mention nematodes applied as a drench, and UC IPM says they are effective when temperatures are between 60 and 90 F and conditions are moist. UConn Extension and UC IPM also mention predatory mites. CSU’s IPM page says these live organisms should be used on arrival.
Sprays for adults. UC IPM says the most effective control targets the larvae and pupae in the soil rather than the short-lived adults, and that insecticides are rarely warranted for these flies in and around homes. No source we read says sprays are fine on edibles. Do not use them on plants you eat unless the product label lists that crop.
Home remedies. Many people search for hydrogen peroxide drenches, cinnamon, vinegar traps and neem. None of the pages we used for this guide recommend them, and CSU Extension says contact sprays made with neem, soaps or oils do not give sufficient long-term control of adults. Some other extension and ask-an-expert pages do suggest a diluted hydrogen peroxide soil drench. We have not checked that for herbs and vegetables, so we are not giving recipes.
Here is how the options compare.
| Option | What it does | What sources say | Edible-plant note |
|---|---|---|---|
| Let the top dry | Larvae die as soil dries | Depth varies: 1 inch, 1 to 2 inches, or 2 inches | Nothing applied to the plant. Avoid letting plants wilt. |
| Drainage and repotting | Less standing moisture | Drain saucers; a mix with more perlite or sand drains better | Nothing applied to the plant |
| Yellow sticky cards | Catch adults and show if numbers change | Traps alone will not significantly reduce a population | Nothing is sprayed or mixed into the soil |
| Sand or gravel layer | May limit egg-laying sites | Evidence mixed | Sources do not comment on edible pots |
| Bti drench | Targets fly larvae; temporary control | Maryland: drenches labeled for indoor plants. NDSU: repeat applications may be needed | No page we read covers herbs or edibles. Read the label for your crop and any wait before harvest. |
| Nematodes or predatory mites | Live predators of larvae | Listed by some sources | Sources are about houseplants and greenhouses |
| Sprays for adults | Kill adults only | Temporary unless the area where larvae develop is also treated | Not for plants you eat unless the label lists that crop |
Seedlings and young plants
Seedlings are where the sources are most cautious. UC IPM says that when present in large numbers, larvae can damage roots and stunt plant growth, particularly in seedlings. Utah State University Extension says the same for seedlings and young plants.
We found no seedling-specific treatment in the sources, so the general advice applies. For the usual rhythm of watering small plants, see our guide to how often to water container vegetables.
Keeping them out
- Inspect what comes in. CSU’s IPM page says examining the soil of new plants can help prevent introducing gnats. Purdue Extension, NDSU Extension and NC Cooperative Extension (Beaufort County) name plants brought in from outdoors, or newly bought plants and potting soil, as ways gnats arrive.
- Watch the potting mix. NC Cooperative Extension (Beaufort County) says contaminated potting soil can bring gnats in.
- Water less when growth slows. CSU’s IPM page notes that plants use less water in cooler, shorter days.
If you are setting up a new herb pot, our guide to how many basil plants per pot is a good place to start. New to this? Try our indoor vegetable gardening guide for beginners. And if the pests you are fighting are outdoors on brassicas, see what is eating your broccoli.
Want a nudge on what to grow indoors this winter? Get our free Fall & Winter growing calendar.
Fungus gnat FAQ
How do I get rid of fungus gnats on edible plants?
Extension sources start with watering. NC Cooperative Extension (Beaufort County) says letting the top inch of soil dry between waterings disrupts the life cycle, while CSU Extension says the top 1 to 2 inches. Yellow sticky cards catch adults. Any treatment for larvae should be checked against its label for the crop you eat.
Will fungus gnats go away on their own?
The sources we read do not say they go away on their own. CSU Extension and Wisconsin Extension say the life cycle can take three to four weeks, so new adults can keep emerging for a while. Our reading is that results take weeks, not days.
Are fungus gnats harmful to basil and other herbs I eat?
Sources differ. University of Maryland Extension says they do not significantly damage indoor plants, while NC Cooperative Extension (Beaufort County) says seedlings and weak plants can have stunted growth. None of the pages we read mention basil specifically.
How do I get rid of gnats in potting soil?
Let the top of the mix dry between waterings and use yellow sticky cards, as CSU, Wisconsin and NDSU Extension describe, and empty saucers, as NC Cooperative Extension (Lee County) advises. UC IPM says a mix with more perlite or sand drains better.
What is safe to use on fungus gnats in herb pots I eat from?
No extension page we read says any treatment is safe on herbs. University of Maryland Extension says Bti drenches are labeled for indoor plants. For plants you eat, read the exact product label for your crop and any wait before harvest.
How do I stop fungus gnats in seedlings?
UC IPM and Utah State University Extension say that when present in large numbers, larvae can damage roots and stunt seedlings. We found no seedling-specific treatment in the sources, so check any product label for your crop.
Sources we checked
- Fungus Gnats as Houseplant and Indoor Pests. Colorado State University Extension, W. Cranshaw and R. A. Cloyd, reviewed 2025.
- Fungus gnats. Colorado State University, Agricultural Biology IPM, page last modified April 2025.
- Fungus Gnats. University of Maryland Extension, updated 2026.
- Fungus Gnats & Shore Flies. UMass Extension Vegetable Program.
- Fungus Gnats: Tiny Pests in Houseplants and How to Control Them. NC Cooperative Extension, Beaufort County, Angela Mason Foster, 2025.
- Fungus Gnats in Houseplants. NC Cooperative Extension, Lee County, Amanda Bratcher, 2024.
- Fungus Gnats, Pest Note 7448. UC IPM, J. A. Bethke and S. H. Dreistadt, 2013.
- Fungus Gnats on Houseplants. University of Wisconsin-Madison Extension, P. J. Liesch and D. Alfuth, revised 2021.
- Fungus Gnats in Houseplants. Iowa State University Extension, Laura Iles, 2023.
- Fungus gnats. University of Minnesota Extension.
- Managing Fungus Gnats in the Greenhouse. UConn Extension, Leanne Pundt, revised 2024.
- Proper Watering Prevents Problems with Fungus Gnats. Purdue Extension, C. Sadof, 2020.
- Dakota Gardener: Houseplant Fungus Gnat Woes. NDSU Extension, Esther McGinnis, 2021.
- Fungus Gnats. Utah State University Extension.
