Menu

How to get rid of fungus gnats in houseplants

Researched by 8 min read

Last updated: 15 November 2026References

Set preferred
Illustration of a woman leaning in to look at a few tiny dark flies hovering over a houseplant on a sunny windowsillIllustration
On this page 10 sections

In short

Let the top of the compost dry out between waterings and clean up standing water, 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.

Jump to the steps

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

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
November 2026

Little black flies puffing up from the pot whenever you water can keep you away from your own plants. UW-Madison Extension notes that getting them under control may take three or four weeks of changed watering and a layer of sand or fine gravel on the compost.

UC IPM explains that fungus gnats spend most of their life as larvae and pupae in the compost, and the flies you see are the short-lived adults. The RHS says the larvae live in damp compost and numbers build up when it stays constantly wet, especially compost rich in organic matter. So the fix has two parts: make the compost a poor nursery, and kill the larvae already in it. UW-Madison Extension says sticky traps help, but changing the conditions in the pot is the single most important step, so if your habit is to hang a trap and hope for the best, I'm afraid the nursery downstairs is still open.

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

Here's why this takes a little patience. UW-Madison says the stages overlap, with eggs, larvae, pupae and adults all present at once, so you need to keep going.

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 (UC IPM), 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, and 24 °C is our conversion. UC IPM says warmer rooms speed things up.

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 slender 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). Fungus gnats are often mistaken for fruit flies, but they are two distinct insects (UW-Madison).

    You should see: small dark flies running over the compost or flying slowly around the plants.

  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. It is that easy, and a potato is a lot cheaper than guessing.

    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, so please don't skip it. 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. Clean up any standing water (UC IPM). 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). What it will do, it catches adults and helps you keep track of their numbers over time (UW-Madison). They help, but changing the conditions in the pot matters most (UW-Madison), and they can catch large numbers of other small creatures, including predators (RHS).

    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. It looks quite smart on top of a pot, too.

    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

    Don't worry, the word sounds much scarier than it is. Nematodes (Steinernema feltiae) are pathogenic nematodes (RHS) that control fungus gnat larvae (UC IPM). 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

    Sometimes a fresh start is the kindest thing for a badly infested pot. 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 egg-laying sites; gnats thrive in moist conditionsUC 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 compostEggs and larvae in the old compostRHS

How to tell they're gone

  • Chunks of potato come up with no larvae underneath (UC IPM).
  • The sticky traps show adult numbers falling over time, as UW-Madison describes.
  • You've kept going for 3 to 4 weeks, which UW-Madison says may be needed alongside drier watering and a sand or gravel layer.
  • The compost surface dries between waterings.

Rules in the UK, Germany, the US and Pakistan

UKGermanyUSPakistan
Do you need a professional?Changing the conditions in the pot is the single most important step (UW-Madison Extension)
If you buy a spray or baitThe label must show the HSE authorisation number and the uses it is authorised for (HSE)Biocide labels name the BAuA registration number (N-...) and the approved uses (DLG guide published by LAVES Niedersachsen)EPA registers all pesticides; read the label before buying and using one (EPA)Every pesticide brand must be registered; selling an unregistered one is an offence (Agricultural Pesticides Ordinance 1971, s. 4)

If they keep coming back

Remember that a few late flies don't mean you've failed, because the ones already in the compost still have to come out. Find what you're seeing below.

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, clean up standing water, 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 mistaken for fruit flies, but they are two distinct insects; fungus gnats lay their eggs on moist potting soil. 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 potting mix can become infested if it isn't pasteurised or is stored open. UC IPM suggests buying pasteurised potting mix and storing it off the ground in a closed container.

Sources and method

Researched by
Abu Bakar Saadat
Tested by our team
No. We have no record of anyone on our team trying these steps, so treat them as researched instructions from the sources below.
Pictures
9 illustrations drawn for this article: drawings, not photos.
Sources
7 named sources, linked below.
What this page adds
A life-cycle diagram with a stage-by-stage table, a 'which treatment works on which stage' table, and the potato-chunk test for larvae.

What to do next

Rescue a struggling houseplant Step 3 of 6

  1. How to get rid of aphids on houseplants without harsh spraysSticky leaves? Look for aphids.
  2. How to repot a houseplant, step by stepRoots poking out of the pot? Time for a bigger home.
  3. How to keep a houseplant alive in low light: pick the spot and check the lightA dark corner needs the right plant and a few tricks.

Did this solve the problem?

What did you think?

Reaction counts are loading.