Gnats in Potting Soil: How to Get Rid of Them Fast

Those tiny flying insects hovering around your houseplants are almost certainly fungus gnats, and they’re one of the most common indoor plant pests. The adults are mostly harmless, but their larvae live in the top layer of moist potting soil, feeding on organic matter and sometimes plant roots. Getting rid of them requires targeting the larvae in the soil, not just swatting the adults you see flying around.

What Fungus Gnats Are and Why They Love Your Soil

Fungus gnats are small, dark-bodied flies about the size of a fruit fly. They’re drawn to moist, organic-rich potting mix, which is exactly what most houseplants sit in. Females lay eggs directly in damp soil, and the larvae feed on fungi, decaying organic material, and fine root hairs in the top few inches of the pot.

Their life cycle is fast. At around 75°F, eggs hatch in about 3 days, larvae develop over roughly 10 days, and adults emerge after another 4 days as pupae. That means a full generation can complete in just 17 days, and warmer indoor temperatures speed this up. A single unaddressed pot can produce overlapping generations continuously, which is why a small problem can become a swarm in a matter of weeks.

How Overwatering Creates the Problem

Fungus gnats thrive in consistently moist conditions. If your soil stays wet between waterings, it creates the perfect breeding ground. The most effective long-term fix is also the simplest: let the top inch or two of soil dry out between waterings. This alone makes the soil inhospitable for egg-laying and kills young larvae, which need moisture to survive. For most houseplants, slightly drier soil between waterings is perfectly healthy and often preferred.

If you tend to water on a schedule rather than checking the soil first, switching to a “finger test” approach helps. Push your finger an inch into the soil. If it’s still damp, wait. This single habit change prevents most fungus gnat infestations from taking hold.

How to Kill Larvae Already in the Soil

Because the adults you see flying are just the visible tip of the problem, effective treatment means killing the larvae living in the potting mix. Several methods work well.

Hydrogen Peroxide Drench

Mix one part 3% hydrogen peroxide (the standard drugstore concentration) with four parts water and pour it directly over the soil as you would a normal watering. The solution fizzes on contact, killing larvae on the spot without harming plant roots. You can repeat this with each watering cycle until the adults stop appearing, which typically takes two to three rounds.

Bti Soil Drench

Bti is a naturally occurring soil bacterium that kills fly and mosquito larvae but is harmless to plants, pets, and people. It’s sold as granules or liquid concentrates labeled for fungus gnats (Mosquito Bits is a widely available consumer product). You dissolve or soak the product in water and use it to water your plants. The larvae ingest the bacteria and die within a day or two. Because new eggs may still hatch, repeat applications every five to seven days for two to three weeks to break the cycle.

Beneficial Nematodes

Microscopic predatory nematodes are another biological option. These tiny worms seek out and kill fungus gnat larvae and pupae in the soil. You mix them into room-temperature water and apply as a soil drench. The soil needs to stay moist for about two weeks after application so the nematodes can move through it and find their targets. Soil temperature should be between roughly 45°F and 85°F. Nematodes are sold refrigerated and need to be applied within hours of mixing, so plan your application before opening the package.

Trapping the Adults

While you’re treating the soil, yellow sticky traps placed near the soil surface catch adult gnats before they can lay more eggs. Adults are strongly attracted to yellow, and the traps are cheap and widely available at garden centers. They won’t solve the problem alone since they only catch adults, but they reduce egg-laying pressure and give you a visual gauge of whether your soil treatments are working. When the traps stop catching new gnats, the infestation is winding down.

Blocking Egg-Laying With a Soil Barrier

A physical barrier on the soil surface can stop female gnats from reaching the potting mix to lay eggs. A quarter-inch layer of coarse sand or fine vermiculite spread on top of the soil works well. Fungus gnats can only deposit eggs about one-sixteenth of an inch deep, so they won’t lay in an inert material like sand. Seedlings push through it without trouble, and established plants aren’t affected at all.

One popular suggestion that doesn’t actually work here is diatomaceous earth. It’s effective against hard-shelled insects like ants and beetles, but fungus gnats don’t have a hard exoskeleton, so the sharp particles don’t damage them the way they do other pests.

Sterilizing Soil Before You Pot

Fungus gnat eggs and larvae often come home with you in the bag of potting soil itself. If you’ve had recurring problems, sterilizing new soil before potting can prevent infestations from starting. Spread the soil about 3 to 4 inches deep on a baking sheet, cover it loosely with aluminum foil, and bake at 180 to 200°F for 30 minutes. Let it cool completely before using it. The heat kills eggs, larvae, and fungal spores without breaking down the soil’s structure. It smells earthy but not terrible.

This is especially worthwhile for indoor plants, where you’re creating a closed environment with no natural predators to keep gnat populations in check. Outdoor potting soil often contains more organic debris and is more likely to harbor eggs.

Combining Methods for Fastest Results

The most effective approach uses multiple strategies at once. Let the soil dry out more between waterings, apply a hydrogen peroxide or Bti drench to kill existing larvae, set out yellow sticky traps to catch adults, and add a sand layer to block new egg-laying. Because the full life cycle takes about 17 days, you should expect to continue treatment for at least three to four weeks to catch every generation. Most people see a dramatic drop in adults within the first week or two, with stragglers tapering off after that.

Fungus gnats are persistent but not invincible. Once you break the breeding cycle in the soil, the flying adults disappear within days since they only live about a week. The key insight is that everything that matters is happening below the surface, in the potting mix itself.