Getting rid of gnats in your house starts with figuring out what type you’re dealing with, because the fix depends entirely on where they’re breeding. 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, and killing the adults without destroying the breeding site means they’ll keep coming back. A single generation of fungus gnats can go from egg to adult in just 17 days at room temperature, so populations explode fast once they establish themselves.
Identify Which Gnat You Have
Before you grab a spray or set a trap, spend 30 seconds watching the bugs. Where they hover tells you almost everything you need to know.
- Fungus gnats are small, dark flies that swarm around houseplants. They fly in erratic, bouncing patterns and are drawn to moist potting soil, where they lay eggs. Their larvae feed on roots and organic matter in the soil.
- Fruit flies are brownish with striped abdomens, about an eighth of an inch long, and cluster around fruit bowls, garbage cans, compost bins, and sink drains with food residue. They come in red-eyed and dark-eyed varieties.
- Drain flies have fuzzy, moth-like bodies and oversized wings compared to the other two. They stick close to sink or floor drains and thrive in the slimy biofilm that builds up inside pipes.
If you see a cloud of tiny flies rising from a potted plant when you water it, those are fungus gnats. If they’re circling a banana on your counter, fruit flies. If they’re sitting on the bathroom wall near the shower drain, drain flies. Once you know the type, you can target the breeding source directly.
Getting Rid of Fungus Gnats
Fungus gnats are the most common indoor gnat, and the fix is straightforward: dry out their breeding ground. The adults are harmless to you, but their larvae live in the top layers of moist potting soil, feeding on roots and fungi. Left unchecked, they can damage your plants’ root systems.
Let the Soil Dry Out
The single most effective step is letting the top inch or two of soil dry completely between waterings. Fungus gnat eggs and young larvae need consistent moisture to survive. Most houseplants tolerate drier topsoil better than you’d expect, and this alone can break the breeding cycle within a few weeks. Stick your finger into the soil before watering. If it feels damp at all in the top inch, wait.
Add a Sand or Gravel Barrier
Covering the soil surface with a layer of coarse sand or fine gravel creates a physical barrier that adult gnats can’t dig through to lay eggs. A layer of three-quarters of an inch to one inch works well for most pots. Sand drains quickly and stays dry on top even after watering, which makes the surface inhospitable. Any larvae already in the soil won’t be able to reach the surface once they mature. Combined with reduced watering, this is often enough to completely eliminate an infestation.
Use Sticky Traps for Adults
Yellow sticky traps placed near the soil surface catch adult gnats before they can lay new eggs. These won’t solve the problem on their own since larvae are still developing underground, but they reduce the breeding population and give you a visual gauge of how bad the infestation is. When the traps stop catching flies, you’ve broken the cycle.
Bottom Watering
Instead of pouring water over the top of the soil, set pots in a tray of water and let the soil wick moisture up from below. This keeps the top layer dry while the roots still get what they need. After 20 to 30 minutes, dump any water the plant hasn’t absorbed.
Because the full lifecycle from egg to adult takes roughly 17 days at typical indoor temperatures (eggs hatch in about 3 days, larvae develop over 10 days, and pupae emerge as adults after another 4 days), you need to maintain these measures for at least 3 to 4 weeks to outlast the entire generation.
Getting Rid of Fruit Flies
Fruit flies breed wherever there’s decaying organic matter, and they’re remarkably good at finding it. A single overripe tomato or a splash of juice in the bottom of a recycling bin is enough to sustain a population.
Eliminate Food Sources
Start with a thorough kitchen sweep. Store ripe fruit in the refrigerator, not on the counter. Empty kitchen trash cans daily, especially in warm weather. Clean the inside of your garbage disposal by running it with cold water and ice, then flushing with a mix of baking soda and vinegar. Wipe down counters and check under appliances for spills or forgotten produce. Rinse cans and bottles before putting them in recycling bins. Fruit flies can breed in a thin film of juice on a glass surface, so even small residues matter.
Trap the Remaining Adults
Once the food sources are gone, the adults still flying around will live for another week or two. A simple vinegar trap speeds things up: pour a half inch of apple cider vinegar into a jar, add a drop of dish soap to break the surface tension, and cover the top with plastic wrap poked with a few small holes. The flies crawl in and can’t get out. Place traps near the areas where you see the most activity. Replace the vinegar every few days.
The key with fruit flies is consistency. If you clean up 90% of the food sources but leave a wet sponge in the sink or a forgotten potato in the pantry, the population persists. Check drains, too. Fruit flies sometimes breed in the organic buildup inside kitchen sink drains, which overlaps with drain fly territory.
Getting Rid of Drain Flies
Drain flies breed in the slimy biofilm that coats the inside of pipes, particularly in drains that don’t get heavy daily use. Bathroom sinks, shower drains, and floor drains in basements or laundry rooms are common hot spots. The flies themselves are slow and easy to swat, but the real population is the larvae embedded in that slime layer deep inside your plumbing.
Scrub the Drain Mechanically
The most reliable approach is physical removal of the biofilm. Use a stiff drain brush (a long, narrow bottle brush works) to scrub the inside walls of the drain as far down as you can reach. This removes the accessible slime and the larvae living in it. Follow up by flushing the drain with boiling water.
Enzyme-based drain cleaners are often recommended, but they work slowly, require repeated applications, and rarely eliminate the entire biofilm layer. The buildup inside a drain can extend several feet along the pipe interior, and a single treatment poured from the opening can’t reach all of it. Mechanical scrubbing is more effective for the accessible portion, and persistent infestations may need a plumber to clean the full pipe.
Keep Drains Flowing
After the initial deep clean, run water through all your drains regularly, including ones you don’t use often. A drain that sits dry and undisturbed for weeks is an open invitation. If you have a floor drain in a basement or utility room that rarely gets water, flush it weekly. Covering infrequently used drains with a plug or screen also keeps adult flies from accessing the pipe to lay eggs.
Traps and Sprays That Work Across Types
Apple cider vinegar traps catch fruit flies effectively and will attract some fungus gnats, though they’re less reliable for drain flies. Yellow sticky traps are better for fungus gnats. For drain flies, the traps are less useful since the adults tend to stay near their drain rather than fly toward bait.
Pyrethrin-based sprays, available at most hardware stores, kill adult gnats on contact and break down relatively quickly indoors. If you use any indoor spray, remove pet food bowls, bedding, and toys from the area first. Keep pets out of treated rooms until the spray has dried completely, and ventilate the space well during drying. Cover fish tanks and turn off any air circulation systems that could spread the aerosol into other rooms. Sprays only kill the adults you can see, so they’re a supplement to source elimination, not a replacement.
Preventing Gnats From Coming Back
Most indoor gnat problems come down to moisture and organic debris. A few habits keep all three types from re-establishing:
- Water houseplants from the bottom and let soil surfaces dry between waterings. Repot plants in well-draining soil if the mix stays soggy for days.
- Store produce in the fridge once it starts to ripen, and clean up fruit juice spills immediately.
- Run all drains weekly, including ones in guest bathrooms or basements that don’t see regular use.
- Take out kitchen trash daily in warm months, and keep bins clean with an occasional rinse.
- Check new plants before bringing them inside. Fungus gnats often hitch a ride from nurseries in potting soil.
Gnats reproduce fast, but they also die off fast once their breeding site is gone. Most infestations clear up within two to four weeks of removing the source, which is enough time for the last generation of larvae to mature and die without producing offspring.