How to Get Rid of Flies in Houseplants

Tired of houseplant flies? Address the root cause with proven methods for killing adult pests and eradicating larvae in the soil.

The tiny flies hovering around your houseplants are almost certainly fungus gnats, small dark insects in the family Sciaridae that breed in moist potting soil. Getting rid of them requires targeting the larvae living in the soil rather than just swatting at the adults you see flying around. The adults are mostly a nuisance, but the larvae feed on organic matter and plant roots, and they can even spread fungal diseases from pot to pot. A combination of drying out the soil, trapping adults, and treating the growing medium is the most reliable approach.

What Those Little Flies Actually Are

Fungus gnats look like tiny mosquitoes, roughly two to four millimeters long with dark bodies and translucent wings. They are weak fliers, so you will often see them crawling on the soil surface or making short, erratic flights near the pot. People sometimes confuse them with fruit flies, but fruit flies are drawn to ripening produce rather than potting soil, and they have a rounder, more orange-brown body. If the flies are concentrated around your plants and the soil surface, you are dealing with fungus gnats.

The adults live only about a week, but in that time a single female can lay dozens of eggs in the top layer of moist soil. The eggs hatch into translucent, worm-like larvae with dark heads that feed on fungi, decaying organic matter, and fine root hairs in the growing medium. After a couple of weeks of feeding, the larvae pupate and emerge as new adults, starting the cycle over. In a warm house with consistently moist soil, generations overlap and populations can build quickly.

Why They Chose Your Plants

Fungus gnats need two things: moisture and organic matter. Standard peat-based potting mixes provide both in abundance. Overwatering is the single biggest factor that turns a houseplant collection into a fungus gnat nursery. When the top layer of soil stays damp, it creates ideal conditions for the fungi and microbes the larvae eat, and it keeps eggs from drying out. Plants that sit in saucers of standing water, pots without drainage holes, and recently repotted plants with fresh soil are especially vulnerable.

Bagged potting soil from the garden center can already harbor fungus gnat eggs or larvae before it reaches your home. If you open a bag and notice tiny flies within a few days, the infestation came with the soil. Composted materials mixed into potting blends are a common source, since the decaying organic matter is exactly what fungus gnats seek out.

The Damage They Do

A small number of fungus gnats is mostly cosmetic annoyance. But larger populations cause real harm. The larvae chew through fine root hairs and can bore into the base of stems, especially in seedlings and young transplants. Research on greenhouse crops has shown that fungus gnats are major pests largely because of this direct larval feeding damage and their ability to transmit soil-borne plant pathogens from plant to plant.

The pathogen angle is worth understanding if you grow many plants in close proximity. Adult fungus gnats have been shown to carry Fusarium, a group of fungi responsible for root rot and wilt diseases, from infected plants to healthy ones. One study demonstrated that adult gnats transported Fusarium from both laboratory cultures and infected host plants to healthy tomato and bean seedlings, causing new infections. Similar findings have been documented in strawberry cultivation, where Fusarium was detected in adult gnats collected from greenhouse plants. This means that even if an infested plant seems fine, the gnats could be carrying root-rot spores to the healthy plant sitting next to it.

Start With Watering Habits

The cheapest and most effective first step costs nothing: let your soil dry out more between waterings. Fungus gnat eggs and young larvae are vulnerable to desiccation. If the top couple of centimeters of soil dry completely between waterings, many eggs will never hatch, and surviving larvae will have a harder time finding the moist fungal food sources they need. Most common houseplants tolerate this approach well, and many actually prefer it. Pothos, snake plants, ZZ plants, dracaenas, and succulents all thrive when allowed to dry between drinks.

Bottom watering can also help. Instead of pouring water onto the soil surface, set the pot in a tray of water and let the soil wick moisture up from below. This keeps the top layer drier while still hydrating the root zone. Remove the pot from the tray after about 30 minutes so it does not sit in standing water. The dry surface makes the soil less attractive for egg-laying adults.

For plants that genuinely need consistently moist soil, like ferns and calatheas, reducing watering is not always realistic. These plants will need other interventions from the strategies below.

Trapping the Adults

Yellow sticky traps are the standard tool for catching adult fungus gnats. The insects are strongly attracted to the yellow color and get stuck on the adhesive surface. Commercial growers use yellow sticky traps extensively for both monitoring and reducing adult populations. For houseplants, small stakes with yellow sticky cards that you push into the soil work well. Place one in each badly infested pot, or at minimum one per cluster of plants.

Sticky traps will not solve the problem on their own because they only catch the short-lived adults. They are useful for gauging how bad the infestation is and for reducing the number of adults laying new eggs while your soil-level treatments take effect. If the traps are catching dozens of gnats per day, you have a significant population breeding in the soil and need to address the larvae directly.

Research into fungus gnat visual preferences has found that UV light at around 382 nanometers is the most attractive wavelength, followed by green-yellow light in the 532 to 592 nanometer range. This explains why yellow sticky traps work and also why some people report success with UV-based insect traps. A small plug-in UV trap near your plant shelf can catch adults at night, though these are supplementary and should not replace soil treatment.

Monitoring With Potato Slices

If you want to know how bad the larval population is before choosing a treatment, raw potato slices are a surprisingly effective monitoring tool. Place a small disc of potato on the soil surface and check the underside after a few days. Fungus gnat larvae are attracted to the potato and will congregate on it, giving you a clear picture of population density. Research has confirmed that potato discs placed on the potting medium are a reliable method for monitoring fungus gnat populations. If you flip a potato slice and find a dozen or more tiny translucent larvae, you know soil-level treatment is needed. Discard the slice and the larvae afterward.

Treating the Soil

Several approaches target the larvae where they live. Here are the options that have the most evidence and practicality for home growers.

Beneficial Nematodes

Microscopic parasitic nematodes, particularly the species Steinernema feltiae, are one of the most effective biological treatments for fungus gnat larvae. You buy them as a living product (usually shipped in a sponge or gel), mix them with water, and drench the soil. The nematodes seek out gnat larvae, enter their bodies, and release bacteria that kill them within a day or two. Studies on greenhouse crops have demonstrated that nematode drenches significantly reduce fungus gnat populations, though the right application rate matters and can vary depending on the host plant and potting medium.

For home use, follow the dosage on the product packaging and apply as a soil drench after a normal watering, since the nematodes need moisture to move through the soil. They are harmless to plants, pets, and people. The main downside is that they are a perishable living product: they need to be refrigerated and used before the expiration date. A repeat application after two weeks helps catch any larvae that hatched after the first treatment.

Predatory Mites

Another biological option is the predatory mite Stratiolaelaps scimitus, sometimes sold under the older name Hypoaspis miles. These tiny soil-dwelling mites feed on fungus gnat larvae and can establish ongoing populations in the soil, providing long-term suppression rather than a one-time knockdown. Research has shown that these mites develop and reproduce successfully when fed fungus gnat larvae, completing their development cycle in under ten days. They are invisible to the naked eye for most people, and they will not crawl out of the pot or bother anyone.

One caution: if you are also using chemical pesticides or certain fungicides on your plants, these can harm the predatory mites. Lab studies have shown that common greenhouse pesticides can affect Stratiolaelaps scimitus survival. If you plan to use biological controls, avoid spraying the soil with synthetic insecticides at the same time.

Bacillus thuringiensis israelensis (Bti)

Bti is a naturally occurring soil bacterium that produces toxins specifically lethal to the larvae of flies and mosquitoes. It is sold as a liquid concentrate or as dissolvable dunks originally designed for mosquito control in standing water. Dissolved in your watering can and applied as a soil drench, Bti kills fungus gnat larvae when they ingest it. It is widely considered safe for plants, mammals, and beneficial insects other than fly larvae. Most houseplant growers find that watering with a Bti solution every one to two weeks for about a month breaks the breeding cycle. It is one of the most recommended treatments in indoor gardening communities because it is cheap, effective, and nontoxic.

Hydrogen Peroxide Drenches

A dilute hydrogen peroxide solution (typically one part 3% household hydrogen peroxide to four parts water) is a popular home remedy. The fizzing action when it contacts organic soil is thought to kill larvae on contact. It breaks down rapidly into water and oxygen, so it does not persist in the soil. Many growers report success with this method. However, hydrogen peroxide is not selective and affects soil microbes along with the larvae. Research on hydrogen peroxide applied to soil has found effects on the soil microbial community structure. If you rely on living soil biology or have recently introduced beneficial organisms like nematodes or predatory mites, hydrogen peroxide could undermine those treatments. Used occasionally as a spot treatment, it is a reasonable tool, but it is not the best choice for repeated use.

Physical Barriers on the Soil Surface

Covering the top of the potting mix with a material that adult gnats cannot easily lay eggs through is a simple, chemical-free approach. A layer of coarse sand, fine gravel, or decorative pebbles about two centimeters deep discourages egg-laying because the surface dries quickly and does not offer the soft, moist organic surface the females look for.

Research has tested this concept more rigorously using porous aggregate materials. A study found that a thick layer (about 3 cm) of small aggregate particles significantly reduced or delayed fungus gnat adult emergence and may have affected egg survival as well. The key factors were particle size and layer thickness: small particles packed more tightly and left fewer gaps for gnats to navigate.

One material that sounds promising but disappoints in practice is diatomaceous earth. It is often recommended for insect control, but research specifically on fungus gnats found that layers of diatomaceous earth generally did not prevent adult emergence or egg laying. The material absorbed moisture from the potting medium and expanded, creating cracks that larvae and egg-laying females exploited easily. This is a good example of a widely repeated tip that does not hold up when tested. If you are going to use a top dressing, coarse sand or gravel is a better bet.

Soil Amendments and Repotting

If your infestation is severe and you are due for a repot anyway, replacing the soil entirely removes the larvae and pupae living in it. Shake as much old soil off the roots as the plant can tolerate, clean the pot, and repot into fresh mix. To reduce the attractiveness of the new soil, consider amending it with perlite, coarse pumice, or other inorganic components that improve drainage and reduce the amount of decaying organic matter the larvae feed on.

An interesting line of research has found that amending potting soil with byproducts from black soldier fly farming dramatically reduced fungus gnat populations. In laboratory trials, adding these byproduct mixtures to commercial potting soil decreased fungus gnat numbers by up to 93% compared with unamended potting soil. The effect appeared to come from both reduced egg-laying by adult females and increased larval mortality, possibly related to the chitin content of the amendment making the soil less hospitable. Chitin-rich amendments like crab meal and shrimp shell powder are already available to gardeners, and while the research on their specific effects on houseplant fungus gnats is still emerging, the principle is worth knowing about for anyone looking for a preventive soil strategy.

Putting It All Together

No single method reliably eliminates fungus gnats if used alone. The most effective approach layers multiple strategies:

  • Reduce moisture: Let the top few centimeters of soil dry between waterings whenever the plant tolerates it. Bottom-water moisture-loving species.
  • Trap adults: Yellow sticky traps near every infested plant reduce egg-laying pressure.
  • Treat larvae: Choose one soil-level treatment: Bti drenches, beneficial nematodes, or predatory mites. Repeat as directed.
  • Block access: A top dressing of coarse sand or fine gravel makes it harder for surviving adults to reach the soil to lay eggs.

Give the combined approach about four to six weeks. You are trying to break the reproductive cycle, and there will be overlapping generations already in the soil at different life stages when you start. The sticky traps serve as your progress report: a declining catch each week means the soil treatments are working.

Preventing Reinfestation

Once you have the population under control, prevention is mostly about not recreating the conditions that invited the gnats in the first place. Avoid overwatering. Dump saucer water promptly. When you bring a new plant home, quarantine it away from your collection for a couple of weeks and watch for adult gnats on the soil surface. Inspect bagged potting soil before use; if you see any tiny flies when you open the bag, either let the soil dry out completely before potting, or heat-treat it by spreading it on a baking sheet and warming it in the oven.

Emptying and cleaning drip trays, removing dead leaves from the soil surface, and keeping the area around your plants free of organic debris all help reduce the food sources that sustain fungus gnats. The larvae eat decaying matter, so a fallen leaf sitting on damp soil is an invitation. For growers with large collections, periodic Bti drenches as a preventive measure (once a month during warm months when populations tend to spike) can keep gnats from ever reaching noticeable numbers.

When the Flies Are Not Fungus Gnats

Occasionally the flies around your houseplants are something else. Shore flies are similar in size but stockier, with shorter antennae and a more robust flight pattern. They breed in algae on the soil surface or in standing water rather than in the soil itself. The fix for shore flies is reducing surface moisture and eliminating algae. Fruit flies sometimes wander toward plants if there is fermenting organic matter in the soil (like a buried banana peel in a DIY compost-amended mix), but they will not breed in ordinary potting soil. Whiteflies are a completely different pest that lives on plant leaves, not in soil, and requires different treatment.

If you are unsure what you are dealing with, the potato-slice test helps. Fungus gnat larvae will cluster on the underside of a raw potato disc within a day or two. If nothing shows up after three days and you still see flies, the problem is likely adults coming from somewhere else, like a drain, a garbage disposal, or a compost bin elsewhere in the house.