Fungus gnats breed in damp soil, so getting rid of them permanently means breaking their life cycle where it happens: below the surface. The tiny flies hovering around your plants are adults that live only a few days, but their larvae thrive in moist potting mix, feeding on fungi, decaying organic matter, and sometimes your plants’ roots. Killing the adults alone does nothing lasting, because a single female can lay dozens of eggs in the soil before she dies. A combination of drying out your growing medium, introducing larva-killing biological agents, and blocking future egg-laying is what actually ends an infestation rather than just suppressing it for a week.
Why They Keep Coming Back
The reason fungus gnats feel impossible to eliminate is that their life cycle is fast and almost entirely hidden from view. Under typical indoor conditions, the complete 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 Eggs hatch in the soil within a few days, and the larvae spend about two to three weeks feeding underground before pupating. Adults emerge, mate almost immediately, and lay a new batch of eggs. If you swat or trap every adult you see but ignore the larvae already developing in the pot, the next generation appears right on schedule.
Moisture is the single biggest factor. Fungus gnats cannot complete their development in dry soil. The larvae need a consistently damp environment with enough organic material to sustain fungal growth, which is their primary food source. Overwatered houseplants, pots without drainage holes, and trays of standing water create ideal breeding conditions. Addressing moisture is both the first step and the most important one.
Where the Infestation Probably Started
Many people assume gnats flew in through a window, and sometimes they did. But a surprising share of indoor infestations arrive in the potting mix itself. Research examining commercial bagged soilless media found that fungus gnats emerged from bags of growing media stored in greenhouses, from media delivered fresh by wholesale distributors, and from rooted plant plugs shipped from growers.2Journal of Economic Entomology. Fungus Gnats, Bradysia spp. (Diptera: Sciaridae), and Other Arthropods in Commercial Bagged Soilless Growing Media and Rooted Plant Plugs In other words, the eggs or larvae can already be inside a sealed bag of potting soil before you open it. That new plant you brought home from the nursery may have carried its own starter population.
The composition of the growing medium also matters. Peat-based mixes with high organic content tend to attract more egg-laying females than inorganic substrates like perlite or sand. Gas chromatographic analysis of one popular peat-based mix showed that after moistening, the chemical profile shifted: certain terpenoid compounds declined while fatty acids increased, and these changes in volatile chemistry appear to influence how attractive the medium is to adult gnats seeking a place to lay eggs.3Insect Science. Effect of growing media and their constituents on fungus gnat, Bradysia sp. nr. coprophila (Lintner) adults This is part of why freshly watered organic soil is so irresistible to them.
Step One Is Always Watering Less
Before you buy any product, change your watering habits. Let the top inch or two of soil dry out completely between waterings. For most houseplants, this is not just tolerable but healthier. Fungus gnat larvae cannot survive in dry conditions, and females strongly prefer to lay eggs in moist soil. Allowing the surface to dry kills existing young larvae near the top and discourages new egg-laying.
If a plant genuinely needs consistently moist soil, such as certain ferns or calatheas, you can still reduce gnat-friendly conditions by improving drainage. Make sure every pot has a drainage hole, empty saucers promptly after watering, and consider switching to a chunkier potting mix that holds less surface moisture. Bottom watering, where you let the pot sit in a tray of water and absorb moisture upward, keeps the top layer drier while still hydrating the root zone.
Covering the Soil Surface
A physical barrier on top of the potting mix does two things: it blocks adult gnats from reaching the soil to lay eggs, and it creates a dry, inhospitable surface even when the soil beneath stays moist. A layer of coarse sand about half an inch deep is one of the oldest and most effective approaches. In greenhouse trials comparing several preventative treatments, sand toppings significantly reduced both fungus gnat and shore fly populations compared to untreated controls.4New Zealand Plant Protection. Preventative treatments for control of fungus gnats and shore flies
Other options include decorative pebbles, a layer of diatomaceous earth, or horticultural grit. The principle is the same: create a dry, inorganic top layer that females will not choose for egg-laying. Diatomaceous earth has the added benefit of being abrasive to soft-bodied larvae that try to travel through it, though it loses effectiveness when it gets wet and needs reapplication. Sand or gravel stays effective indefinitely as long as the layer is thick enough that organic matter does not build up on top.
Biological Controls That Kill Larvae Underground
If drying the soil and covering it are the defensive moves, biological control agents are the offensive ones. Two categories dominate: beneficial nematodes and predatory mites. Both are living organisms you introduce into the soil, where they actively hunt and kill fungus gnat larvae.
Beneficial Nematodes
The nematode Steinernema feltiae is the most widely recommended species for fungus gnats. These microscopic roundworms seek out larvae in the soil, enter their bodies, and release bacteria that kill the host within a day or two. In greenhouse trials with poinsettias, S. feltiae reduced fungus gnat larvae as effectively as the organophosphate insecticide diazinon, making it a practical non-chemical alternative.5Biological Control. Use of Entomopathogenic Nematodes and a New Monitoring Technique for Control of Fungus Gnats, Bradysia coprophila (Diptera: Sciaridae), in Floriculture The same research found that younger larvae were more susceptible to the nematodes than pupae, which is a reason to apply them early in an infestation rather than waiting.
Temperature matters for nematode performance. S. feltiae works best in cooler conditions, roughly between 15 and 25°C (59–77°F), which suits most indoor environments. In warmer settings above 25°C, other nematode species like Heterorhabditis bacteriophora and H. indica outperformed S. feltiae, achieving over 50% reduction in gnat emergence compared to about 38% for S. feltiae at those temperatures.6Biological 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 That same study found no advantage to splitting the nematode application into multiple doses versus a single treatment, which simplifies the process for home growers. You mix the nematodes into water and drench the soil once.
Predatory Mites
The soil-dwelling predatory mite Stratiolaelaps scimitus, sometimes sold under its older name Hypoaspis miles, is widely marketed for fungus gnat management. These mites live in the top layer of soil and actively prey on fungus gnat larvae and other small soil-dwelling organisms. They reproduce and persist in the soil as long as prey is available, which means a single introduction can provide ongoing control rather than just a one-time knockdown.7PubMed. 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 invisible to the naked eye and harmless to plants and people. Their main limitation is that they cannot eliminate a heavy infestation on their own; they work best as a preventative or in combination with nematodes.
Trapping and Repelling the Adults
Trapping adults does not solve the problem by itself, but it reduces the number of egg-laying females and helps you monitor whether your soil-level treatments are working. Yellow sticky traps are the standard tool. Fungus gnats are strongly attracted to yellow, and studies in forest nurseries confirmed that yellow traps captured far more adults than transparent ones.8Revista 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 near the soil surface rather than up high, since fungus gnats tend to stay close to their breeding site.
Research into the visual behavior of fungus gnats has found that UV light and green-yellow light are the most attractive wavelengths. Combining UV and yellow LEDs in a single trap improved capture rates beyond what either light source or a standard yellow sticky trap achieved alone.9Entomologia Experimentalis et Applicata. Visual orientation of the black fungus gnat, Bradysia difformis, explored using LEDs For home use, simple yellow sticky cards are more than adequate, but if you are dealing with a larger grow space, adding a small UV light near the traps can boost their effectiveness.
On the repellent side, certain plant-derived volatile compounds show real activity against adult gnats. In lab testing, menthol, 1-octen-3-ol (a compound found in many mushrooms), and borneol significantly repelled fungus gnat adults. The number of gnats that chose treated areas was roughly a fifth to a third of the number that chose untreated control areas.10Oxford Academic (Journal of Economic Entomology). Repellency of Naturally Occurring Volatile Alcohols to Fungus Gnat Bradysia sp. nr. coprophila (Diptera: Sciaridae) Adults Under Laboratory Conditions These were lab conditions, and the effect of dabbing peppermint oil around your houseplants in a real room would be less dramatic, but it is not pure myth either. The compounds genuinely deter the insects at close range.
Neem-Based and Microbial Products
Two products dominate the home-grower toolkit for fungus gnats: neem oil (or more precisely, its active compound azadirachtin) and Bacillus thuringiensis subspecies israelensis, commonly sold as Bti.
Azadirachtin acts as an insect growth regulator, disrupting molting and development in larvae. Testing confirmed it as a suitable reference substance for fungus gnat bioassays, and its toxicity to larvae was higher at warmer temperatures and in denser soil substrates.11PubMed 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, this means a soil drench with diluted neem oil concentrate works better in warm indoor environments than in cool ones. The larvae ingest the azadirachtin and fail to develop normally, reducing the next generation of adults. One drawback is that neem breaks down quickly in soil and needs reapplication every week or two until the infestation is resolved.
Bti is a naturally occurring soil bacterium that produces proteins toxic specifically to the larvae of flies and mosquitoes. You dissolve it in water and use it as a soil drench. Greenhouse trials found that Bti applied at weekly intervals was among the treatments producing the lowest fungus gnat numbers.4New Zealand Plant Protection. Preventative treatments for control of fungus gnats and shore flies It is safe for plants, pets, and people, targeting only dipteran larvae. The catch is the same as neem: it does not persist long in the soil, so consistency matters. Missing a week gives surviving larvae time to pupate beyond the reach of the next application.
Why This Is Worth Doing Thoroughly
Fungus gnats are not just annoying. Their larvae can damage fine root hairs, which matters most for seedlings, cuttings, and young plants that have not yet developed a robust root system. Worse, both larvae and adults can carry plant pathogens from pot to pot. Larvae that fed on fungal cultures of Pythium aphanidermatum, a common root-rot pathogen, readily introduced the fungus to healthy cucumber plants when they moved through the root zone.12Annals of Applied Biology. Transmission of Pythium aphanidermatum to greenhouse cucumber by the fungus gnat Bradysia impatiens (Diptera: Sciaridae)
Adults play a role too, though not equally for all pathogens. Adult fungus gnats have been shown to externally carry and disperse spores of several soilborne pathogens including Verticillium dahliae, Fusarium acuminatum, and Thielaviopsis basicola. Scanning electron microscopy confirmed that conidia adhered to the outside of the adult insects, and their larvae’s intestinal contents and droppings also contained viable fungal material.13Annals of Applied Biology. Acquisition, retention and dispersal of soilborne plant pathogenic fungi by fungus gnats and moth flies Adult gnats were also demonstrated to transport Fusarium oxysporum f.sp. radicis-lycopersici from infected tomato plants to healthy ones.14Annals of Applied Biology. Fungus gnats vector Fusarium oxysporum f.sp. radicislycopersici
The picture is slightly more nuanced for Pythium specifically: while larvae clearly transmit it, research found that adult fungus gnats did not pick up infectious Pythium propagules from diseased plants and transmit them to healthy ones. DNA from the pathogen was detectable in larval and pupal stages but not in emerged adults.15PubMed. Transstadial transmission of Pythium in Bradysia impatiens and lack of adult vectoring capacity So the threat from adults depends on which pathogen is involved, but the larvae are consistently problematic. If you have multiple plants and one develops root rot, an unchecked gnat population can spread the infection to pots across the room.
Putting It All Together in Practice
The most reliable approach layers multiple strategies so that no single life stage goes unaddressed. Start by letting the soil dry and placing yellow sticky traps near the affected plants to immediately reduce the adult population. Apply a Bti drench or neem soil drench once a week for at least three to four weeks to cover the full larval development window. If you want a longer-term solution, introduce beneficial nematodes or predatory mites into the soil after the initial knockdown; these continue working without repeat applications as long as the soil stays reasonably moist (which it will once you resume normal watering).
Once the infestation is under control, prevention is straightforward. Add a sand or grit topping to susceptible pots. Inspect new plants and repotting soil before introducing them to your collection. Avoid letting saucers accumulate standing water. With these habits, a re-infestation would need to overcome multiple barriers, which is what “for good” actually looks like in practice: not a single magic treatment, but an environment that no longer supports the fungus gnat life cycle.
Do Treatments Harm the Soil
A reasonable concern when drenching soil with nematodes, Bti, or neem is whether you are disrupting the beneficial microbial community that healthy plant roots depend on. The short answer is that the disturbance tends to be mild and temporary. A review of non-target effects from biological control agents in soil found that impacts on microbial communities were usually confined to a single growing season and were typically smaller than the effects caused by normal plant aging or standard agricultural practices like tilling and fertilizing.16FEMS Microbiology Ecology. Non-target effects of bacterial biological control agents suppressing root pathogenic fungi Bti in particular is highly specific in its action, targeting only fly and mosquito larvae while leaving other soil organisms alone. Nematodes like S. feltiae are similarly selective, seeking out insect larvae rather than broadly altering the soil ecosystem. For a home grower treating a few pots, the ecological footprint is negligible compared to the root damage and disease transmission an unchecked gnat population causes.