How to Get Rid of Soil Flies in Your Plants

Those tiny flies hovering around your houseplants are almost certainly fungus gnats, the most common type of soil-dwelling fly found indoors. They’re about 1/8 inch long, dark brown or black, and weak fliers that tend to rest on the surface of potting soil rather than zip around your kitchen. While the adults are mostly just annoying, their larvae live in the top layer of soil and can damage plant roots, especially in seedlings and young plants.

A few other species also show up in and around potted soil, and telling them apart helps you choose the right fix.

Identifying the Flies in Your Soil

Fungus gnats are the most likely culprit. They’re delicate, mosquito-shaped flies that hover lazily near the soil surface or congregate around windows. You’ll often notice them when you water a plant or disturb the pot. Their larvae are slender, whitish or translucent maggots about 1/4 inch long with a distinctive black head capsule. If you gently dig into moist potting mix and spot tiny clear worms with dark heads, you’ve confirmed fungus gnats.

Shore flies look similar at first glance but are stockier and more muscular, closer in build to a fruit fly. They’re strong, fast fliers, which immediately sets them apart from the clumsy fungus gnat. If you look closely at the wings, you’ll see five light-colored spots on a dark background. Shore fly larvae are opaque, lack the black head, and have a pair of small breathing tubes at their rear end. Shore flies feed on algae rather than fungi, so they tend to show up where there’s standing water, wet trays beneath pots, or green algae growth on soil surfaces.

Drain flies (sometimes called moth flies) are a third possibility. They’re fuzzy, moth-shaped, and typically found near sinks or drains rather than plant pots. If your flies are concentrated around plumbing fixtures, the soil isn’t your problem.

Why They Show Up

Fungus gnats need two things: moisture and organic matter. Potting soil that stays consistently damp creates an ideal breeding ground. Female fungus gnats lay up to 200 eggs in clusters right on the surface of moist growing media. The eggs are tiny enough that you won’t see them, and at around 75°F they hatch in just three days. The larvae then spend about 10 days feeding on fungi, decaying organic material, and fine root hairs before pupating. Four days after that, new adults emerge. The entire cycle from egg to egg-laying adult takes roughly 17 days in warm conditions, and multiple generations overlap throughout the year.

This is why infestations seem to explode overnight. By the time you notice adult flies, there are likely eggs, larvae, and pupae all developing in the soil simultaneously. Warmer indoor temperatures speed everything up, and overwatered plants provide the constant moisture the larvae need to survive.

Shore flies arrive for slightly different reasons. They follow algae, which grows wherever moisture sits for long periods: in saucers, on the surface of waterlogged soil, on the sides of terracotta pots. Eliminating standing water and algae buildup solves most shore fly problems.

Damage to Plants

Adult fungus gnats don’t bite, don’t eat plant tissue, and pose no direct threat to your plants. The larvae are the concern. In small numbers, they feed mostly on decaying matter and fungi in the soil and cause little harm. In larger populations, they chew on fine root hairs and can bore into the base of stems, particularly on seedlings, cuttings, and young transplants. Damaged roots become entry points for soil-borne diseases that cause root rot and wilting.

Established, healthy houseplants can tolerate moderate fungus gnat populations without visible symptoms. If you’re seeing yellowing leaves, wilting despite adequate water, or stunted growth in combination with lots of flying adults, the larvae may be causing real root damage.

Cutting Off the Breeding Cycle

The single most effective step is letting your soil dry out between waterings. Fungus gnat eggs and young larvae can’t survive in dry conditions. Allow the top inch or two of potting mix to dry completely before watering again. This alone breaks the cycle for many people. For plants that need consistent moisture, consider bottom-watering by filling the saucer and letting the plant absorb water from below, keeping the top layer of soil drier.

A layer of coarse sand, perlite, or fine gravel on top of the soil (about half an inch) also discourages egg-laying. Female gnats prefer to lay eggs directly on moist organic media, and an inorganic top layer makes the surface less appealing. Removing any decaying leaves or organic debris from the soil surface eliminates food sources for larvae.

When bringing new plants home, isolate them for two to three weeks. Many infestations start with eggs or larvae already present in store-bought potting soil or nursery plants.

Trapping Adults

Yellow sticky traps placed horizontally near the soil surface catch adult fungus gnats effectively. The flies are attracted to the yellow color and get stuck on contact. Sticky traps won’t eliminate an infestation on their own since they don’t reach the larvae, but they reduce the number of adults laying new eggs and give you a visual gauge of how bad the problem is. If the traps are catching fewer flies week over week, your other control methods are working.

Killing Larvae in the Soil

A hydrogen peroxide drench targets larvae directly. Mix one part standard 3% hydrogen peroxide with four parts water and pour it through the soil as you would a normal watering. The solution fizzes on contact with organic matter and kills larvae without harming plant roots. Let the soil dry out afterward to prevent reinfestation.

For a biological approach, beneficial nematodes (specifically the species sold as “Sf” nematodes) are microscopic roundworms that actively hunt and kill fungus gnat larvae in the soil. Lab and greenhouse trials show they reduce fungus gnat populations by 70% or more when applied correctly. You can buy them online or at garden centers, typically shipped as a powder or gel that you mix into water and pour over the soil.

A few guidelines for nematode success: soil temperature should be between 55°F and 85°F, which covers most indoor environments. Apply in the evening or early morning since the nematodes are sensitive to UV light. Keep the soil moist for at least two weeks after application so the nematodes can move through the media and find larvae. Research from Cornell University recommends a minimum density of about 25 nematodes per square centimeter of soil surface. Since nematodes don’t establish permanent populations indoors, you’ll likely need to reapply if the infestation recurs.

Shore Flies Need a Different Approach

If your flies are the sturdier, faster-flying shore fly type, soil drying alone won’t solve the problem. Shore flies feed on algae, not fungi, so the fix is eliminating algae growth. Empty saucers after watering, clean green buildup off pot surfaces and trays, and improve air circulation around your plants. Reducing humidity and ensuring water doesn’t pool on any surface removes their food source. Once the algae is gone, shore flies have no reason to stay.