How to Get Rid of Small Plant Flies for Good

Those tiny flies hovering around your houseplants are almost certainly fungus gnats, and killing the adults you see buzzing around is only a fraction of the solution. The real population lives in the soil as eggs and larvae, and unless you target that hidden stage, new adults will keep emerging every few weeks. Getting rid of them for good requires a combination of drying out the soil surface, killing larvae before they mature, and preventing reinfestation from new potting mix or plants you bring home.

Why They Keep Coming Back

Fungus gnats belong to the family Sciaridae, and the species most common in homes and greenhouses is Bradysia impatiens. The adults are the ones you notice, but they only live about two days after emerging. Their entire purpose during that brief window is to mate and lay eggs in moist soil. A single female can deposit dozens of eggs just below the surface, and in warm indoor conditions the full cycle from egg to adult takes roughly 25 days.

1Southwestern Entomologist. Biological Cycle of the Fungus Gnat Bradysia sp. in a Lily (Lilium spp.) Crop

That fast turnover is why a small nuisance can balloon into a persistent problem. By the time you swat the adults or set out a trap, a new generation of larvae is already chewing through organic matter in the potting mix. Overlapping generations develop quickly indoors, where temperatures and moisture are stable year-round. The key insight is that any strategy focused only on the flying adults ignores about 90 percent of the population.

Why They Actually Matter for Your Plants

Fungus gnat larvae feed mostly on decaying organic material and fungi in the soil, but they also nibble on fine root hairs, especially in seedlings and young plants. The feeding damage alone can stunt growth and cause wilting in small or delicate plants. For mature houseplants with robust root systems, the direct damage from a moderate infestation is usually minor.

The more serious risk is disease. Fungus gnat larvae can pick up soilborne pathogens like Pythium species and carry them from one plant to another. Lab studies have shown that larvae feeding on infected roots can transmit Pythium aphanidermatum to healthy plants, with transmission rates as high as 65 percent under controlled conditions.

2PubMed. Larval Bradysia impatiens (Diptera: Sciaridae) potential for vectoring Pythium root rot pathogens

Larvae are not the only stage involved. Adult fungus gnats have been shown to carry pathogens like Fusarium and Verticillium on their bodies, spreading them above the soil surface as they move between pots.

3Annals of Applied Biology. Acquisition, retention and dispersal of soilborne plant pathogenic fungi by fungus gnats and moth flies

That said, the larvae do most of the heavy lifting when it comes to spreading root rot. Research on cucumber found that larvae readily introduced Pythium to plants by feeding on infected material and then moving to healthy roots, while adult transmission dropped to very low levels.

4Annals of Applied Biology. Transmission of Pythium aphanidermatum to greenhouse cucumber by the fungus gnat Bradysia impatiens (Diptera: Sciaridae)

Let the Soil Dry Out

This is the single most effective thing you can do, and it costs nothing. Fungus gnat females strongly prefer moist soil for egg-laying, and larvae need damp conditions to survive. If you let the top inch or so of potting mix dry out completely between waterings, you create a hostile environment for both eggs and young larvae.

For most common houseplants, the roots sit in the lower half of the pot, so a dry surface does not mean the plant is suffering. Switch to bottom watering if your plants tolerate it: set the pot in a tray of water for 20 to 30 minutes and let the soil wick moisture up from below, then empty the tray. The surface stays dry, which is exactly what you want. Plants that demand constantly moist soil, like ferns and calatheas, make this harder, but even these benefit from not being kept sopping wet on top.

Overwatering is the root cause of almost every fungus gnat problem in homes. If you fix nothing else, fix the watering schedule, and the population will crash on its own within a few weeks as larvae dry out and females move on to find better egg-laying sites.

Cover the Soil Surface

A physical barrier over the potting mix stops females from reaching the soil to lay eggs in the first place. A layer of coarse sand, fine gravel, or decorative pebbles about half an inch deep works well. Research on greenhouse plants found that sand toppings significantly reduced both fungus gnat and shore fly numbers compared to uncovered controls.

5New Zealand Plant Protection. Preventative treatments for control of fungus gnats and shore flies

The barrier works because fungus gnat females need to push into soft, moist organic matter to deposit eggs. Sand drains quickly and stays dry on the surface, making it unappealing. Perlite alone is less effective because it is light enough that gnats can push past it, and it retains some surface moisture. Diatomaceous earth is sometimes recommended, but it loses its effectiveness when wet, which limits its usefulness in a pot that gets watered regularly.

If you already have an active infestation, a top dressing alone will not fix it. The larvae and pupae already in the soil will still emerge as adults. You need to combine the barrier with a method that kills the larvae below.

Biological Controls That Target Larvae

Several living organisms can be introduced to potting soil to kill fungus gnat larvae. These are widely available online and at garden centers, and they are safe around pets and children.

Bacillus Thuringiensis Israelensis (Bti)

Bti is a naturally occurring soil bacterium that produces a protein toxic to fly larvae when they ingest it. Products containing Bti, sold as granules or liquid concentrates under various brand names, are mixed into your watering can and applied as a soil drench. When tiny, early-stage larvae eat the Bti in the soil, it kills them.

The catch is timing. Research has shown that Bti has little effect on older, larger larvae. It works best against the youngest stages, which means you need to apply it early and repeatedly to catch each new wave of eggs as they hatch.

6Pest Management Science. Effect of Bacillus thuringiensis subsp. israelensis and neonicotinoid insecticides on the fungus gnat Bradysia sp nr. coprophila (Lintner) (Diptera: Sciaridae)

A weekly Bti drench for three to four consecutive weeks is the standard approach. Since the full life cycle is about 25 days, that schedule ensures you hit at least two generations of newly hatched larvae. Missing a week gives older larvae a window to mature untouched.

Beneficial Nematodes

Microscopic predatory nematodes, particularly Steinernema feltiae, are another effective option. You buy them in a small packet, mix them into water, and drench the soil. The nematodes actively seek out and parasitize fungus gnat larvae. Research in greenhouse settings found that a standard application rate consistently suppressed fungus gnat populations in potted ornamentals.

7Biological Control. Application rate and timing, potting medium, and host plant effects on the efficacy of Steinernema feltiae against the fungus gnat, Bradysia coprophila, in floriculture

Temperature matters when choosing a nematode species. S. feltiae performs best at cooler temperatures typical of most homes. In warmer environments above about 25°C (77°F), species like Heterorhabditis bacteriophora and H. indica outperformed S. feltiae in greenhouse trials.

8Biological Control. Effect of entomopathogenic nematode species, split application and potting medium on the control of the fungus gnat, Bradysia difformis (Diptera: Sciaridae), in the greenhouse at alternating cold and warm temperatures

Nematodes are living organisms, so they need to be stored in the fridge and used before their expiration date. Apply them to already-moistened soil in the evening or on a cloudy day, since UV light kills them. They will not survive in bone-dry soil, so this method works best when you are keeping the soil slightly moist rather than fully dried out.

Predatory Mites

Stratiolaelaps scimitus (formerly called Hypoaspis miles) is a soil-dwelling mite that feeds on fungus gnat larvae. It reproduces and persists in the potting mix, providing ongoing control rather than a one-shot treatment. Studies have confirmed that these mites develop and reproduce successfully on a diet of fungus gnat larvae alone.

9PubMed. Development and reproduction of Stratiolaelaps scimitus (Acari: Laelapidae) with fungus gnat larvae (Diptera: Sciaridae), potworms (Oligochaeta: Enchytraeidae) or Sancassania aff. sphaerogaster (Acari: Acaridae) as the sole food source

The mites are tiny and stay in the soil, so you will not see them crawling around your home. They are a particularly good option if you have a large collection of plants and want passive, long-term suppression. The downside is that they work slowly and are better at maintaining low populations than wiping out an active heavy infestation.

Trapping the Adults

Yellow sticky traps are the classic tool for catching adult fungus gnats. They work because the flies are strongly attracted to the color yellow. Studies comparing yellow sticky cards to transparent ones have confirmed that yellow consistently catches more adults.

10Revista Chapingo serie ciencias forestales y del ambiente. Monitoring the Dark Winged Fungus Gnat (Bradysia impatiens Johannsen) with Yellow Sticky Traps in Forest Nurseries

Place the traps horizontally just above the soil surface or stick them into the pot on a small stake. The adults tend to fly low, close to the soil where they emerged, so traps elevated to window height catch far fewer. Adding a small light source can boost effectiveness. Green LED-equipped yellow traps caught more fungus gnats than unlit traps in greenhouse cage studies, and UV light appears to be even more attractive to them.

11Insect Science. Lime Green Light-Emitting Diode Equipped Yellow Sticky Card Traps for Monitoring Whiteflies, Aphids and Fungus Gnats in Greenhouses12Institutionelles Repositorium der Leibniz Universität Hannover. LED based trapping of whiteflies and fungus gnats: from visual ecology to application

Traps alone will not solve the problem. They reduce the adult population and slow egg-laying, but they cannot reach the larvae developing in the soil. Think of them as a useful supplement to soil-level treatments, and as a monitoring tool. If the traps stay clean for two to three weeks, you have probably broken the cycle.

Neem and Other Botanical Options

Azadirachtin, the active compound in neem oil, disrupts insect development and has documented effects on fungus gnat larvae. Research has shown that it increases larval development time and reduces the number of adults that successfully emerge, with stronger effects at warmer temperatures.

13PubMed Central. A new ecotoxicological test method for genetically modified plants and other stressors in soil with the black fungus gnat Bradysia impatiens (Diptera): current status of test development and dietary effects of azadirachtin on larval development and emergence rate

In practice, you can use a neem oil soil drench by mixing cold-pressed neem oil with water and a drop of dish soap as an emulsifier, then watering it into the potting mix. The effect is slower than Bti or nematodes, and you will need repeated applications. Neem oil sprayed on the soil surface may also deter egg-laying to some degree, though the evidence for that is more anecdotal than experimental. Hydrogen peroxide diluted to about a 3 percent solution and poured through the soil is another popular home remedy. It fizzes on contact and can kill larvae it reaches directly, but it also kills beneficial soil organisms and breaks down quickly, making it a blunt tool compared to more targeted options.

Preventing Reinfestation From New Soil and Plants

One of the most frustrating scenarios is clearing an infestation only to have it return when you repot a plant or bring a new one home. Research has found that fungus gnats emerged from commercially bagged soilless growing media that was stored in a greenhouse, from freshly delivered potting mix, and from rooted plant plugs shipped by wholesale distributors.

14Journal of Economic Entomology. Fungus Gnats, Bradysia spp. (Diptera: Sciaridae), and Other Arthropods in Commercial Bagged Soilless Growing Media and Rooted Plant Plugs

That means even a sealed bag of potting soil from the garden center can harbor eggs or larvae. Pasteurizing the soil before use is the most reliable prevention. You can bake small batches in the oven at about 180°F (82°C) for 30 minutes, or microwave a damp batch in a covered container until the internal temperature reaches 180°F. This kills eggs, larvae, and any weed seeds as a bonus. The soil will smell earthy and slightly unpleasant during the process, but it cools quickly.

For new plants, quarantine them away from your existing collection for at least three to four weeks after bringing them home. Place a yellow sticky trap near the new plant to monitor for adults. If you see gnats, treat the soil with Bti or nematodes before moving the plant near your others. This single habit prevents the vast majority of reintroductions.

Interestingly, female fungus gnats do not seem to strongly prefer one brand or type of soilless mix over another for egg-laying. Lab tests offering them multiple commercial potting mixes found no significant differences in the number of eggs laid across substrates, though all organic soilless mixes were vastly preferred over inert surfaces like filter paper.

15Journal of Economic Entomology. Egg-Laying Preference of Female Fungus Gnat Bradysia sp. nr. coprophila (Diptera: Sciaridae) on Three Different Soilless Substrates

Switching to a chunkier, less moisture-retentive mix with more perlite, bark, or pumice will not eliminate the risk of gnats, but it helps the surface dry faster between waterings, which circles back to the most important factor of all.

Putting a Multi-Step Plan Together

No single method works perfectly on its own. The most reliable approach layers several strategies that target different life stages at the same time. Let the soil surface dry out between waterings. Apply a Bti drench weekly for three to four weeks to kill newly hatched larvae. Set yellow sticky traps near the soil to intercept adults and monitor your progress. Add a half-inch sand or gravel top dressing to block future egg-laying. And quarantine every new plant or bag of soil that enters your home.

Most people see dramatic improvement within two weeks and a complete end to the problem within four to six weeks if they stay consistent. The most common reason for failure is stopping Bti treatments too early, before the final generation of larvae has been killed. Since a full cycle takes about 25 days, cutting corners at the three-week mark leaves one last wave of adults ready to restart the cycle. Patience over that last stretch is what separates people who solve the problem from people who keep fighting it every few months.

When Fungus Gnats Are Not Actually Fungus Gnats

Not every small fly near your plants is a fungus gnat. Drain flies (moth flies) are fuzzy, moth-shaped, and breed in sink drains or standing water rather than potting soil. Shore flies look similar to fungus gnats but are stockier with shorter antennae and breed in algae on wet surfaces. Fruit flies are attracted to ripening produce, not soil. If your traps catch flies but they do not look like the delicate, mosquito-like fungus gnats, you might be treating the wrong pest. Drain flies require cleaning the organic buildup inside pipes, and fruit flies need you to remove the food source. The soil treatments described here will do nothing for those species.