Those tiny black flies hovering around your houseplants or kitchen are almost certainly fungus gnats, and the key to eliminating them is targeting their larvae in moist soil, not just swatting the adults you see flying around. Adult gnats live only about a week, but a single female can lay dozens of eggs in damp potting mix, keeping the cycle going indefinitely. Breaking that cycle requires a combination of drying out their breeding grounds, killing larvae already in the soil, and trapping adults before they can lay more eggs.
Identify What You’re Dealing With
Fungus gnats are the most common black gnats found indoors. They’re tiny (about 1/16 to 1/8 inch long), dark, and delicate, with long segmented antennae and slender legs that give them a mosquito-like appearance. Unlike houseflies, they’re weak fliers. You’ll notice them running across the surface of potting soil, resting on leaves, or hovering lazily near windows and plants rather than zipping around the room.
If your gnats are clustered near fruit bowls or trash cans instead of plants, you may have fruit flies, which are tan or brownish with red eyes. If they’re emerging from bathroom or kitchen drains, drain flies are the more likely culprit, and they have fuzzy, moth-like wings. The strategies below focus on fungus gnats, since they’re the species most people mean when they search for “black gnats in the house.”
Cut Off Their Breeding Ground
Fungus gnat females lay eggs in moist organic material, and indoor potting soil is their favorite nursery. The larvae are tiny, white, legless worms with shiny black heads that feed on organic matter, root hairs, and fungi in the top layer of soil. If conditions are especially wet, you might even see faint slime trails on the soil surface that look like miniature snail tracks.
The single most effective prevention step is letting the top inch of soil dry out completely between waterings. This makes the surface inhospitable for egg-laying and kills young larvae that need constant moisture to survive. Most houseplants tolerate this easily, and overwatering is a more common problem than underwatering anyway. If you tend to water on a schedule, switch to checking the soil with your finger first.
For plants that need consistently moist soil, cover the surface with a half-inch to one-inch layer of coarse sand or fine gravel. This creates a dry barrier that adult gnats won’t lay eggs in, while water still passes through to the roots below.
Kill Larvae Already in the Soil
Drying out the soil prevents new generations, but you also need to deal with larvae already living in your pots. Two methods work well and won’t harm your plants.
Hydrogen Peroxide Soil Drench
Mix one part standard 3% hydrogen peroxide (the kind sold at drugstores) with four parts water. Pour this solution directly over the soil as you would normally water the plant. It will fizz on contact as it attacks larvae and eggs. The peroxide breaks down into water and oxygen, so it’s harmless to roots. Let the soil dry out afterward before watering again.
BTI (Biological Larvicide)
BTI is a naturally occurring soil bacterium that specifically kills the larvae of gnats, mosquitoes, and certain flies. It’s sold as granules, dunks, or liquid concentrate at most garden centers. You dissolve it in water and use it to water your plants. BTI is extremely safe for household use. The toxin proteins only activate in the alkaline gut of insect larvae. Human and pet stomachs are acidic, which destroys the proteins before they can do anything. Mammals also lack the gut receptors that insects have, so BTI is essentially nontoxic to people, dogs, cats, birds, and fish. It won’t harm your plants either.
BTI is the better long-term option if you have a serious infestation across many plants, because you can use it with every watering for several weeks to catch successive generations of larvae as they hatch.
Trap the Adults
While you’re treating the soil, you want to catch as many adult gnats as possible before they lay new eggs. Two simple traps handle this.
Yellow Sticky Traps
Fungus gnats are strongly attracted to the color yellow. Small sticky traps on stakes, available at any garden store for a few dollars, work surprisingly well. Push the stake into the soil of each infested plant so the sticky surface sits just above the soil line, close to the gnats’ flight path but not touching stems or leaves. You’ll start seeing gnats stuck to the surface within hours. Replace the traps when they’re covered.
Apple Cider Vinegar Traps
Pour about 1/3 cup of apple cider vinegar into a small jar or bowl, add two tablespoons of water, and one single drop of liquid dish soap. The vinegar’s fermentation scent draws gnats in, and the soap breaks the surface tension of the liquid so they sink and drown instead of landing on top and flying away. Place these traps near problem areas. They work best for fruit flies but will catch some fungus gnats too, especially if you set them near plants.
A Combined Approach Works Fastest
No single method eliminates gnats overnight, because eggs and larvae already in the soil will keep producing new adults for two to three weeks even after you start treatment. The fastest results come from using all three strategies at once: let soil dry out (or add a sand layer) to stop new egg-laying, drench with hydrogen peroxide or BTI to kill existing larvae, and place sticky traps to catch adults in the meantime. Most people see a dramatic drop in gnat numbers within one to two weeks, with full elimination by three to four weeks.
Prevent Them From Coming Back
Fungus gnats almost always arrive in potting soil. Bags of potting mix stored in warm, humid conditions can harbor eggs or larvae before you even open them. When repotting, consider using the soil straight from a freshly opened bag rather than one that’s been sitting open in the garage. Some gardeners microwave small batches of soil or bake it at 200°F for 30 minutes to sterilize it before potting, though this can smell unpleasant.
Beyond soil, keep organic debris cleaned up. Compost bins, overripe fruit, damp mops left in buckets, and wet cleaning rags can all attract or sustain gnats. Fix any leaky pipes under sinks, since standing moisture in dark cabinets creates another potential breeding spot. If you bring new plants home from a nursery, quarantine them in a separate room for a week or two and inspect the soil surface for tiny adults or larvae before placing them near your other plants.
Good watering habits are ultimately the best long-term defense. If the top layer of your soil stays dry between waterings and you avoid letting pots sit in saucers full of standing water, fungus gnats have nowhere to reproduce, and the problem stays gone.