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 Abu Bakar SaadatPublished 28 October 20267 min readPublisher: Saadat Rafiq
✓ Reviewed by Sonia Abu Bakar, MSc Botany · 28 October 2026
IllustrationAt 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

Each treatment hits one stage, and the stages overlap, so you need to keep going until a full generation has passed.
| Stage | Where | How long |
|---|---|---|
| Egg | Laid in the surface layer of moist compost (RHS) | About 3 days at 24 °C (UC IPM); 3 to 6 days (UW-Madison) |
| Larva | In 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) |
| Pupa | In the compost | About 4 days at 24 °C (UC IPM) |
| Adult | Near pots and windows; weak fliers (UC IPM) | About a week (UW-Madison) |
| Whole cycle | About 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
Make sure they are fungus gnats.

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.
Put potato chunks on the compost to find the larvae.

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.
Let the top of the compost dry out between waterings.

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.
Stand yellow sticky traps next to the pots.

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.
Cover the compost with a layer of coarse sand or fine gravel.

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.
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 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.
If one pot is badly infested, repot it into new compost.

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
| Treatment | Works on | Source |
|---|---|---|
| Drier compost surface, sand or gravel layer | Fewer eggs laid; larvae need moisture | UC IPM, UW-Madison, RHS |
| Yellow sticky traps | Adults only | UC IPM, UW-Madison |
| Bti | Larvae only | UC IPM, UW-Madison |
| Steinernema feltiae nematodes | Larvae | UC IPM, RHS |
| Predatory mites, rove beetle | Eggs, larvae and pupae | RHS |
| Repotting into new compost | Everything in the old compost | RHS |
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 happens | What it means | What to do |
|---|---|---|
| Flies return after a week | New adults from larvae and pupae already in the compost | Keep the compost dry and repeat Bti every 5 to 7 days (UW-Madison) |
| Compost never dries on top | Too much water, or poor drainage | Water less, empty saucers, improve drainage (UC IPM) |
| Flies appear after you open new compost | Eggs or larvae in stored mix | Use pasteurised mix; store it closed and off the ground (UC IPM) |
| Only one pot has larvae | That pot is the source | Treat or repot that one, and keep it apart (UC IPM, RHS) |
| Seedlings or cuttings wilting | Larvae 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.
Sources
We base our articles on the makers' official documentation.

