HowToSimply Quizzes Surprise me

How to get rid of fungus gnats in houseplants

In short: Let the top of the compost dry out between waterings and empty saucers, catch adults on yellow sticky traps, and treat the compost with Steinernema feltiae nematodes or a Bti product to kill the larvae. Keep going for 3 to 4 weeks.

By Published 28 October 20267 min readPublisher: Saadat Rafiq

✓ Reviewed by Sonia Abu Bakar, MSc Botany · 28 October 2026

Illustration of a woman leaning in to look at a few tiny dark flies hovering over a houseplant on a sunny windowsillIllustration

At a glance

What they are
Small dark flies, 3 to 4 mm (RHS); larvae live in damp compost
Main cause
Compost that stays wet (RHS)
Treat
Drier compost, sticky traps, nematodes or Bti
How long
3 to 4 weeks of changed watering may be needed (UW-Madison)
Advice from
UC IPM, RHS and University of Wisconsin-Madison Extension, read 28 October 2026
Checked
October 2026

The flies you see are only the adults. Their larvae live in the top layer of damp compost, and numbers build up when compost stays constantly wet, especially compost rich in organic matter (RHS). So the fix has two parts: make the compost a poor nursery, and kill the larvae already in it. Sticky traps alone won't do it (UW-Madison Extension).

Why it takes a few weeks

Circular diagram of the fungus gnat life cycle around a cut-away pot: tiny eggs on the compost surface, a pale larva with a black head in the compost, a pupa, and a small dark winged adult, joined by curved arrows
Diagram: egg, larva, pupa, adult

Each treatment hits one stage, and the stages overlap, so you need to keep going until a full generation has passed.

StageWhereHow long
EggLaid in the surface layer of moist compost (RHS)About 3 days at 24 °C (UC IPM); 3 to 6 days (UW-Madison)
LarvaIn the compost: whitish, see-through body, shiny black head, up to 6 mm (RHS)About 10 days at 24 °C (UC IPM); 1 to 2 weeks (UW-Madison)
PupaIn the compostAbout 4 days at 24 °C (UC IPM)
AdultNear pots and windows; weak fliers (UC IPM)About a week (UW-Madison)
Whole cycleAbout 17 days at 24 °C (UC IPM); 3 to 4 weeks (UW-Madison); about a month in summer (RHS)

UC IPM gives its figures at 75 °F; 24 °C is our conversion. Warmer rooms speed things up (UC IPM).

How to get rid of them

  1. Make sure they are fungus gnats.

    Enlarged illustration of a slender dark fly with long legs, long antennae and clear wings, resting on the edge of a plant pot
    Illustration: an adult, greatly enlarged

    Adults are dark, delicate flies that look like tiny mosquitoes, about 1.5 to 3 mm long (UC IPM) or 3 to 4 mm (RHS), with long legs and antennae longer than the head (UC IPM). They hang around pots and compost and are drawn to windows (UC IPM). Shore flies look similar but have short, bristly antennae (UC IPM). Flies around the fruit bowl rather than the pots are more likely fruit flies.

    You should see: small dark flies that rise from the compost when you water or brush the leaves, and fly weakly.

  2. Put potato chunks on the compost to find the larvae.

    Illustration of two raw potato chunks lying cut side down on the compost of a houseplant pot
    Illustration

    Place chunks of raw potato cut side down on the compost (UC IPM; not peel). After 3 to 4 days, lift them and look underneath (UW-Madison Extension). Throw them away and put down fresh ones if you're keeping watch (UC IPM). Do this on each pot to see which ones are breeding the flies.

    You should see: on an infested pot, tiny pale larvae with black heads on the underside of the potato or in the compost just beneath.

  3. Let the top of the compost dry out between waterings.

    Illustration of a pot standing in a saucer of water so the compost soaks it up from below, its top surface pale and dry
    Illustration: watering from below keeps the surface dry

    This is the step that matters most. Avoid overwatering and let the compost surface dry between waterings (UC IPM). UW-Madison Extension says to let the top 2.5 cm (1 in) dry before watering, or to water from below so the surface stays dry. Empty saucers so pots don't stand in water. Drying the compost reduces numbers as long as the plant can cope with it (RHS).

    You should see: a pale, dry top layer between waterings. Our guide to checking whether a plant needs water shows how to judge it.

  4. Stand yellow sticky traps next to the pots.

    Illustration of a small square yellow sticky card on a thin stick pushed into the compost beside the leaves, a few tiny dark flies stuck to it
    Illustration

    Cut traps into small squares and fix them on sticks pushed into the compost (UC IPM), near the leaves (UW-Madison Extension). They catch adults before they lay more eggs and show you whether numbers are falling. They are not a complete fix on their own (UW-Madison), and they also catch harmless and helpful insects (RHS), so use them indoors and take them away when you're done.

    You should see: flies stuck to the card. Swap traps when they're covered, and compare the counts week by week.

  5. Cover the compost with a layer of coarse sand or fine gravel.

    Cut-away illustration of a pot with a thin layer of coarse pale sand spread over the top of the compost around the plant stems
    Illustration

    A layer about 1.5 to 2.5 cm (1/2 to 1 in) deep keeps the surface drier and less attractive for egg laying (UW-Madison Extension). Keep it clear of the stems.

    You should see: the compost fully hidden under a dry, even layer.

  6. Careful: read the product label before use. Use only a product whose label covers your use, and follow its rate and interval.

    Water nematodes or Bti into the compost to kill the larvae.

    Illustration of a woman pouring a watering can of cloudy treatment liquid evenly over the compost of a houseplant, a plain unmarked packet on the table
    Illustration

    Nematodes (Steinernema feltiae) are tiny worms that infect the larvae. They work best in moist compost between about 16 and 32 °C (UC IPM, our conversion of 60 to 90 °F), keep searching for hosts, and are perishable, so use them as soon as they arrive (UC IPM). The RHS also lists predatory mites and a rove beetle as biological controls.

    Bti kills only fly larvae, not eggs, pupae or adults (UC IPM, UW-Madison). It doesn't last indoors, so apply it several times, 5 to 7 days apart (UW-Madison; UC IPM says about every five days), and water it in well so it reaches the larvae (UW-Madison). Nematodes and Bti can be used together (UC IPM).

    You should see: over the following weeks, fewer new flies on the traps and fewer larvae under the potato chunks.

  7. If one pot is badly infested, repot it into new compost.

    Illustration of a houseplant being lifted out of its old pot over a bin, with an opened bag of fresh potting mix and a clean pot waiting on the table
    Illustration

    The RHS suggests repotting into newly bought compost and not reusing the old compost (it can go on a compost heap). Use a houseplant potting mix (RHS) and see our guide on how to repot a houseplant. Don't move infested plants next to clean ones (UC IPM).

    You should see: the potato test on the repotted plant comes up clean.

Which treatment works on which stage

TreatmentWorks onSource
Drier compost surface, sand or gravel layerFewer eggs laid; larvae need moistureUC IPM, UW-Madison, RHS
Yellow sticky trapsAdults onlyUC IPM, UW-Madison
BtiLarvae onlyUC IPM, UW-Madison
Steinernema feltiae nematodesLarvaeUC IPM, RHS
Predatory mites, rove beetleEggs, larvae and pupaeRHS
Repotting into new compostEverything in the old compostRHS

How to tell they're gone

  • Potato chunks come up with no larvae underneath (UC IPM).
  • Fresh sticky traps catch no new flies for a week or more.
  • You've kept going for 3 to 4 weeks: UW-Madison says that long with drier watering and a sand or gravel layer may be needed.
  • The compost surface dries between waterings.

If they keep coming back

What happensWhat it meansWhat to do
Flies return after a weekNew adults from larvae and pupae already in the compostKeep the compost dry and repeat Bti every 5 to 7 days (UW-Madison)
Compost never dries on topToo much water, or poor drainageWater less, empty saucers, improve drainage (UC IPM)
Flies appear after you open new compostEggs or larvae in stored mixUse pasteurised mix; store it closed and off the ground (UC IPM)
Only one pot has larvaeThat pot is the sourceTreat or repot that one, and keep it apart (UC IPM, RHS)
Seedlings or cuttings wiltingLarvae can feed on young roots and stems (RHS)Treat promptly; check the watering too (UC IPM)

Questions readers ask

Do fungus gnats bite or harm people?

No. UC IPM says the adults don't bite people and don't damage plants. They are a nuisance, and the larvae in the compost are the stage that can harm roots.

Will fungus gnats kill my plant?

Rarely. The RHS says established plants are unlikely to be harmed; the larvae mostly eat dead roots, decaying plant matter and fungi. Seedlings, young plants and soft cuttings are at more risk (RHS, UC IPM). If a plant wilts, check the watering first: UC IPM says wilting is more often caused by water problems or root decay than by the larvae.

Are they the same as fruit flies?

No. UW-Madison Extension points out they are often confused, but fungus gnats breed in damp potting compost, not in fruit. It also says vinegar traps don't work for monitoring fungus gnats; use yellow sticky traps or potato chunks instead.

Where did they come from?

Females lay eggs in moist potting compost and organic debris (UC IPM), so they can arrive in a new plant or a bag of compost. UC IPM suggests buying pasteurised potting mix and storing it off the ground in a closed container.