The best approach for gnats depends on which type you’re dealing with, because the tiny flies people call “gnats” are usually one of three insects: fungus gnats, fruit flies, or drain flies. Each one breeds in a different spot, so the fix that wipes out one type won’t touch another. The good news is that all three respond well to simple, inexpensive home remedies once you target the right source.
Identify Which Gnat You Have
Before reaching for any trap or treatment, take 30 seconds to figure out what you’re actually fighting. Fungus gnats are black or brown, fly erratically near houseplants, and look like they’re bouncing in the air above the soil. Fruit flies are slightly larger (about ⅛ to 3/16 inch), brownish-black with striped abdomens, and cluster around fruit bowls, garbage cans, and sink drains. Drain flies are the oddball of the group: fuzzy-bodied with oversized wings, almost moth-like, and they hover near sink or floor drains.
If you see a swarm above a potted plant, you have fungus gnats. If they’re circling your kitchen counter or trash can, fruit flies. If they appear every time you turn on the bathroom light, drain flies. Each one needs a different strategy.
Getting Rid of Fungus Gnats
Fungus gnats are the most common indoor gnat, and they breed fast. A single generation goes from egg to adult in about 17 days at room temperature. Eggs hatch in roughly 3 days, larvae develop over 10 days, and adults emerge about 4 days after that. This means a small problem becomes a big one within weeks if you don’t break the cycle.
Let the Soil Dry Out
The single most effective thing you can do is let the top inch or two of your plant soil dry completely between waterings. Fungus gnat larvae need moist soil to survive. When you cut off that moisture, you kill larvae and make the surface inhospitable for egg-laying adults. This alone solves mild infestations.
Hydrogen Peroxide Soil Drench
For a more aggressive approach, mix one part 3% hydrogen peroxide (the standard drugstore kind) with four parts water and pour it directly over the soil as you would normally water the plant. The mixture will fizz on contact, which is it attacking the larvae. It won’t harm your plants. Let the soil dry out afterward before watering again. One or two applications a week apart usually handles moderate infestations.
Sticky Traps for Adults
Yellow sticky traps placed near the soil surface catch adult gnats before they can lay more eggs. These won’t eliminate an infestation on their own, but they reduce the breeding population and give you a visual read on how bad the problem is. If the traps are still covered after two weeks of drying out the soil and using peroxide, the infestation is severe enough to consider repotting with fresh, sterile soil.
Diatomaceous Earth as a Soil Barrier
Food-grade diatomaceous earth is made from microscopic fossilized shells that shred larvae and adult gnats on contact. Spread a thin layer across the top of the soil, or mix it into your potting mix when repotting. In testing, it produced noticeable results within a week and nearly eliminated populations within three weeks. Make sure you buy the food-grade version, not the type sold for pool filters, and wear a mask while applying it since the fine dust can irritate your lungs.
Getting Rid of Fruit Flies
Fruit flies are attracted to fermenting organic matter: overripe bananas, the residue inside a wine bottle, wet garbage, compost bins. The fix starts with removing what’s feeding them.
Cut Off Their Food Source
Store ripe fruit in the refrigerator instead of leaving it on the counter. Rinse food and drink containers before recycling them. Seal your trash can and take the garbage out frequently. Wipe down counters and clean sink drains where food residue collects. Without a food source, fruit flies stop reproducing within days.
The Vinegar Trap
While you’re cleaning up, set out a simple trap to catch the adults already flying around. Pour 3 to 4 tablespoons of apple cider vinegar into a glass or jar and add one or two drops of liquid dish soap. The vinegar’s fermentation smell draws the flies in, and the soap breaks the surface tension so they sink and drown instead of landing and flying away. For even better results, roll a piece of paper into a cone with a small opening at the tip and set it in the jar. Flies funnel in through the narrow end and can’t find their way back out.
Place these traps near the areas where you see the most activity. Replace the vinegar every two to three days. You should see a significant drop in numbers within a week, assuming you’ve also cleaned up the food sources.
Getting Rid of Drain Flies
Drain flies breed in the organic sludge that builds up inside pipes, so killing them means cleaning the drain itself. Apply an enzyme-based drain cleaner (not a chemical one, which can damage pipes without fully clearing the biofilm). Let the cleaner sit for several hours, then flush the drain with warm water to wash away loosened buildup. Once the sludge is gone, the flies lose their breeding ground and disappear. If they keep coming back, the buildup is deeper in the plumbing and you may need to repeat the process or snake the drain.
Keeping Gnats Away Outdoors
Outdoor gnats, including biting midges, are harder to eliminate because you can’t control the entire environment. Focus on reducing standing water in your yard: empty saucers under pots, clear clogged gutters, and avoid overwatering garden beds. Gnats breed in moist organic matter, so the drier you keep things, the fewer you’ll have.
For personal protection while you’re outside, essential oils offer a natural repellent option. Lemon eucalyptus oil has the strongest evidence behind it and provides several hours of broad-spectrum insect protection. Lavender, peppermint, and tea tree oil also show repellent activity against small biting insects. You can make a simple spray by combining about 15 drops of lavender oil, 10 drops of lemon eucalyptus oil, and 10 drops of tea tree oil with 2 ounces of distilled water and 2 ounces of white vinegar in a spray bottle. Shake well before each use and reapply every couple of hours.
Why One Method Often Isn’t Enough
Gnats reproduce quickly, and their eggs and larvae are hidden from view, whether deep in soil, inside drains, or in decomposing food scraps. Killing visible adults with a trap feels satisfying, but it doesn’t touch the next generation already developing out of sight. The most reliable approach combines three things: removing the breeding source (moisture, food, or sludge), trapping adults to reduce the egg-laying population, and treating the larvae directly when possible. Doing all three at once collapses the lifecycle from both ends and typically resolves the problem within two to three weeks.