What Causes Fungus Gnats and How to Stop Them

Fungus gnats are caused by one thing above all else: consistently moist soil rich in organic matter. These tiny flying insects lay their eggs in damp potting mix, where their larvae feed on fungi, decaying plant material, and root hairs. If you’re seeing small flies hovering around your houseplants, the conditions in your soil are almost certainly what invited them.

Moisture Is the Primary Trigger

Fungus gnats need wet soil to survive and reproduce. Female gnats seek out moist surfaces to deposit eggs, and the larvae that hatch cannot develop in dry conditions. Overwatering is the single most common reason these pests appear indoors. Every time you water before the top layer of soil has dried, you’re maintaining the exact environment gnats need to complete their life cycle.

Poor drainage amplifies the problem. Pots without drainage holes, saucers left full of standing water, and compacted soil that holds moisture for days all create ideal breeding grounds. The UC Statewide IPM Program identifies poor drainage and waterlogging as leading contributors to fungus gnat infestations, noting that significant root damage and even plant death have been observed in houseplants kept in moist, organically rich soil with high gnat populations.

What Larvae Actually Feed On

Despite the name, fungus gnats don’t just eat fungus. Their larvae consume organic mulch, leaf mold, compost, grass clippings, root hairs, and the fungi that naturally colonize damp soil. Standard potting mixes are essentially a buffet: they contain peat, bark, compost, and other decomposing organic ingredients that support both fungal growth and larval development.

This is why you’ll rarely see fungus gnats in plants potted in mostly inorganic media like perlite, pumice, or lava rock. Less organic material means less food, which means fewer larvae can survive to adulthood.

How They Get Into Your Home

Fungus gnats typically arrive in one of three ways. The most common is through potting soil itself. Bags of potting mix, especially those stored in warm, humid conditions, can already contain gnat eggs or larvae before you ever open them. New plants from nurseries or garden centers are another frequent source, since commercial greenhouses provide ideal gnat conditions. Finally, adult gnats can fly in through open windows or doors, though this is more common in warmer months.

Once a single female finds your moist houseplant soil, she can lay dozens of eggs just below the surface. The population builds quickly because the entire life cycle, from egg to adult, takes only a few weeks in warm indoor temperatures. By the time you notice adults flying around, larvae have likely been feeding in the soil for days.

The Damage They Cause

Adult fungus gnats are mostly a nuisance. They don’t bite, and they don’t directly harm plants. The real concern is underground. Larvae chew on root hairs and can damage root systems, particularly in seedlings, young plants, and cuttings that haven’t established strong roots yet. A small population rarely causes visible harm to mature houseplants, but large infestations in consistently wet soil can stunt growth, cause wilting, and make plants more vulnerable to root rot.

It’s worth noting that the wilting you see alongside a gnat problem is often caused by the same underlying issue that attracted the gnats: waterlogged soil and root decay. The gnats are a symptom of the real problem, not always the cause of it.

How to Break the Cycle

Since moisture is the root cause, drying out your soil is the most effective first step. Let the top inch or two of soil dry completely between waterings. This alone kills existing larvae near the surface and prevents females from laying new eggs. For plants that tolerate it, bottom watering (setting the pot in a tray of water and letting soil absorb moisture from below) keeps the top layer dry while still hydrating roots.

A physical barrier on the soil surface disrupts egg-laying. A half-inch layer of coarse sand, fine gravel, or diatomaceous earth creates a dry, inhospitable surface that adult gnats avoid. Diatomaceous earth has one important caveat: it stops working when wet. Apply it only after the soil surface has dried, and try to keep it dry by watering from the bottom or watering slowly into small spots.

Killing Larvae Directly

For active infestations, two soil drenches are effective. A hydrogen peroxide solution, one part 3% hydrogen peroxide to four parts water, kills larvae on contact when poured through the soil. You’ll see fizzing as it works. Let the soil dry out afterward.

A more targeted option is BTI, a naturally occurring soil bacterium that kills fungus gnat larvae (along with mosquito and blackfly larvae) without affecting plants, pets, or beneficial insects. Larvae must ingest it for it to work, so it’s applied through regular watering rather than as a one-time treatment. Dissolving BTI granules or a portion of a BTI dunk in your watering can and using that water consistently interrupts the breeding cycle within a few weeks. One Reddit user documenting their BTI protocol reported noticeably fewer adults after the first week of weekly applications and no visible gnats by the fifth week.

Trapping Adults

Yellow sticky traps placed near the soil surface catch adult gnats before they can lay eggs. They won’t eliminate an infestation on their own since they don’t touch the larvae, but they reduce the breeding population and give you a clear visual indicator of how severe the problem is and whether it’s improving.

Preventing Reinfestation

Long-term prevention comes down to soil management. Water only when the top layer of soil is dry to the touch. Choose potting mixes with good drainage, or amend heavy mixes with perlite or pumice. Make sure every pot has a drainage hole, and empty saucers after watering. When bringing new plants home, inspect the soil surface for tiny larvae (they’re translucent with dark heads, about a quarter inch long) and consider isolating new plants for a week or two before placing them near your collection.

Storing unused potting soil in sealed containers prevents it from becoming a breeding ground. Open bags left in garages or closets are a common overlooked source of gnats that seem to appear out of nowhere.