Small black flies drift up when you water a plant. They land on the window, the screen, or your coffee. These are fungus gnats, and they come from the soil in your pots.
The good news is that they are easy to stop. The adults are a nuisance, but the real target is the larvae in the soil. Treat both and the problem ends in about a month.
How to know it is fungus gnats
Adult fungus gnats are thin, dark, and about the size of a sesame seed. They have long legs and fly in short, wobbly lines. They stay close to the plant or head for a light.
The larvae are harder to see. They are thin and whitish with a black head, and they live in the top few inches of damp soil.
To confirm, lay a slice of raw potato on the soil. Check under it after a day or two. Larvae gather there to feed. You can also set a yellow sticky trap near the pot. If it fills with small dark flies, you have your answer.
Why they show up
Adult females lay eggs in moist soil. The eggs hatch into larvae. The larvae feed on fungi and decaying plant matter in the soil. They can also chew on fine roots.
Established plants usually handle a light infestation. Seedlings and fresh cuttings are at more risk because their roots are small and soft.
The cycle from egg to adult takes roughly a month indoors. That is why one treatment rarely finishes the job. New adults keep emerging while you work.
Wet soil is the cause. If your plant stays damp for days, read how to tell if a houseplant is overwatered or underwatered and fix the watering first.
Step 1: Let the soil dry out
Larvae need moist soil. Dry soil kills them and stops females from laying eggs.
Push a finger or a wooden skewer two inches into the soil. Water only when it comes out dry. Plants that like to dry out between waterings, such as snake plants, ZZ plants, and succulents, handle this well.
Plants that like even moisture need more care. Let just the top inch dry and no more.
Water from the bottom when you can. Set the pot in a tray of water for 20 to 30 minutes, then lift it out and let it drain. The top layer of soil stays dry, which makes it a poor place for eggs.
Empty every saucer and outer pot after watering. Standing water keeps the soil wet.
Step 2: Trap the adults
Push yellow sticky traps into the soil near the stem. Adults fly to the yellow color and stick to the trap. Replace each trap when it is full.
Traps do not kill larvae. They cut the number of adults that lay new eggs. Use them along with the other steps.
Step 3: Kill the larvae
A product with Bacillus thuringiensis israelensis (BTI) targets fungus gnat larvae. It is sold as mosquito bits, dunks, and as products made for houseplants. It does not harm plants, people, or pets when used as the label directs.
Soak the bits in water as the package says. Use that water to drench the soil. Repeat each time you water for several weeks, or as the label directs. This covers the full life cycle.
Some growers also drench the soil with a mix of one part 3 percent hydrogen peroxide to four parts water. It can kill larvae on contact. Use it on sturdy plants only, and test it on one plant first. Check the roots afterward, since a strong mix can stress them.
Step 4: Cover the soil
Add a layer of coarse sand or fine grit on top of the soil, about one inch deep. The surface dries fast, and adults have a harder time reaching the damp soil below. Do not use fine sand, which packs down and holds water.
Step 5: Repot if the infestation is heavy
If the soil stays full of larvae after a few weeks of treatment, repot. Slide the plant out and shake off as much old soil as you can. Trim any brown or mushy roots with clean scissors. Repot into fresh potting mix in a clean pot with drainage holes.
Pick a mix that drains well. Mixes heavy with peat or bark that stay wet for a long time invite gnats back.
How to keep them from coming back
Check new plants before they join the others. Look at the soil surface and set one sticky trap by the pot for a week or two.
Store open bags of potting mix sealed and dry. Gnats can lay eggs in a bag left open.
Pick up fallen leaves and dead stems from the soil. They feed larvae as they rot.
Water by the soil, not the calendar. Plants in dim rooms or in winter use less water, so they need it less often.
If you still see gnats after four to six weeks of steady work, check every pot in the room. A single forgotten plant with wet soil can restart the cycle in all the others.