How to Keep Gnats Away From Plants for Good

The tiny flies hovering around your houseplants are almost certainly fungus gnats, and the fix starts in the soil, not the air. These pests breed in moist potting mix, so killing the adults you see is only half the battle. A full generation of fungus gnats, from egg to egg-laying adult, takes just 17 days at room temperature. That fast turnover means you need to target both the larvae in the soil and the adults above it to break the cycle.

Why Your Plants Have Gnats

Fungus gnats are drawn to one thing: damp soil rich in organic matter. Overwatering is the leading cause of infestations. When potting mix stays consistently wet, it supports the fungi and decaying plant material that gnat larvae feed on. Poor drainage, pots without holes, and humid indoor conditions all make the problem worse.

Female gnats lay their eggs in the top two inches of soil. The eggs hatch in about three days, and the larvae spend roughly ten days feeding before pupating. Four days after that, new adults emerge and start the cycle again. Because of this speed, a single neglected pot can seed an infestation across a whole shelf of plants within weeks.

Make Sure It’s Actually Fungus Gnats

Fungus gnats are small (about 1/8 inch), dark, and delicate. They’re weak fliers, so you’ll often see them resting on the soil surface or drifting lazily when you bump a pot. Their larvae are tiny white or translucent maggots with a distinct black head capsule, visible if you gently disturb the top layer of soil.

Shore flies look similar but are stockier, fly much more aggressively, and have five pale spots on each wing. They feed on algae rather than fungi and tend to show up where standing water collects. Fruit flies, by contrast, have tan bodies and red eyes, and they cluster around ripening produce, not plant pots. If the bugs are hovering right at the soil line, you’re dealing with fungus gnats.

Adjust Your Watering First

The single most effective change you can make is letting the soil dry out between waterings. Fungus gnats can’t reproduce in dry soil. For most houseplants, allowing the top inch or two to dry completely before watering again is enough to make conditions hostile to eggs and larvae without stressing the plant. Stick your finger into the soil before reaching for the watering can. If it feels damp, wait.

Bottom watering is another practical shift. Instead of pouring water over the soil surface, set the pot in a tray of water and let it absorb moisture from below for 20 to 30 minutes. This keeps the topsoil, where gnats lay eggs, noticeably drier while still hydrating the root zone. It won’t eliminate an active infestation on its own, but it makes your soil far less inviting for new egg-laying.

Kill Larvae in the Soil

Drying the soil out slows the cycle, but if you already have larvae feeding on your plant’s roots, you’ll want a more direct approach.

BTI Granules

BTI is a naturally occurring soil bacterium that’s lethal to gnat and mosquito larvae but harmless to plants, pets, and people. It’s sold as “mosquito bits” or “mosquito dunks” at most garden centers. To use it on houseplants, steep two tablespoons of granules per gallon of water for 30 minutes to an hour, then strain out the bits and use the water to irrigate your plants as you normally would. The BTI-infused water kills larvae on contact in the soil. Repeat with every watering for two to three weeks to catch newly hatching generations.

Beneficial Nematodes

Microscopic nematodes (sold under the species name Steinernema feltiae) are another biological option. These tiny worms actively cruise through moist soil, enter gnat larvae, and release bacteria that kill the host within a few days. You mix them into water and apply as a soil drench. The key requirement is moisture: the soil needs to stay damp for about two weeks after application so the nematodes can move and hunt effectively. Water the soil before applying, and avoid letting it dry out completely during that window. This makes nematodes a better fit for plants that prefer consistent moisture, like ferns or calatheas, since you won’t be drying the soil between waterings during treatment.

Add a Physical Barrier on Top

Because gnats lay eggs in the top two inches of potting mix, covering that surface with a material they can’t burrow through blocks the breeding cycle physically.

A half-inch layer of coarse horticultural sand works well. It stays dry on top even after watering, creating an inhospitable surface for egg-laying. The downside is that sand is dense and fine enough to reduce airflow to the root zone over time, so it’s better as a temporary measure or for plants that tolerate compact conditions.

Food-grade diatomaceous earth is another option. This powdery substance is made from fossilized aquatic organisms and works by damaging the exoskeletons of adult gnats that land on it. Sprinkle a visible layer over the soil surface. The catch: it loses effectiveness when wet. Every time you water, you’ll need to let the surface dry and reapply. Keep reapplying until you stop seeing gnats, which typically takes two to three weeks if you’re also addressing larvae below the surface.

Decorative pebbles or clay balls (like LECA) can serve a similar purpose, though they’re less studied specifically for gnat control. The goal is simply to create a dry, inorganic barrier between the air and the moist organic soil underneath.

Trap the Adults

Yellow sticky traps won’t solve an infestation alone, but they’re useful for two reasons: they reduce the number of adults laying eggs, and they tell you whether your other efforts are working. Fungus gnats are strongly attracted to yellow, and research from Ohio State University found that horizontal placement, with the sticky side facing up on the soil surface or pot rim, catches significantly more gnats than vertical placement.

Place one trap per plant or per cluster of plants. Check them weekly. If the number of gnats on the traps drops over two to three weeks, your soil treatments are working. If numbers stay steady or climb, you likely have a moisture or drainage issue that still needs fixing.

Homemade traps using apple cider vinegar and a drop of dish soap in a shallow dish can catch some adults, but they’re far less effective than sticky traps for fungus gnats. Vinegar traps work better for fruit flies.

Prevent Reinfestation

New potting soil is a common source of gnat eggs. Bagged mixes that contain a lot of peat or compost and have been stored in warm, damp conditions can come pre-loaded with larvae. If you’ve dealt with gnats before, consider letting new soil dry out in an open container before potting, or proactively watering new plants with BTI-treated water for the first few weeks.

Emptying saucers after watering, improving drainage by adding perlite to heavy mixes, and grouping plants by water needs so you’re not overwatering drought-tolerant species alongside moisture-loving ones all reduce the conditions gnats depend on. Quarantining new plants for a week or two before placing them near your existing collection gives you time to spot any hitchhikers before they spread.

The combination that works fastest for most people: let soil dry between waterings, use BTI-treated water when you do irrigate, lay down sticky traps to catch adults, and keep at it for at least three full weeks to outlast the breeding cycle. Most infestations collapse within that window.