The short answer: to get rid of gnats in the house, find where they breed, then dry it out or clean it. Most indoor gnats are fungus gnats in damp houseplant soil: let the top 1 to 2 inches of soil dry, set yellow sticky traps by the pots and treat the soil with Bti if larvae persist. Fruit flies need a vinegar trap and clean counters; drain flies need a scrubbed drain.
- Timeline: about 3 to 4 weeks, because one fungus gnat generation takes roughly 17 days.
- Biggest mistake: vinegar traps don't catch fungus gnats; they're for fruit flies.
- More home tips: sign up for the weekly HomeBase email.
Steps below come from university extension guidance (UC IPM, University of Wisconsin, University of Maryland and Cornell), checked on November 19, 2026. The page covers how to identify your gnat, a step-by-step plan, traps and treatments that work, and prevention.
Which gnat do you have?
| Bug | What it looks like | Where you see it | Where it breeds |
|---|---|---|---|
| Fungus gnat | Slim, dark gray, long legs, mosquito-like | Around houseplants and windows | Damp potting soil |
| Fruit fly | Tan or brown body, red eyes | Fruit bowl, trash, recycling | Overripe produce, spills |
| Drain fly | Fuzzy, gray, moth-like wings | Bathroom and kitchen walls | Slime inside drains |
If they hover around your plants, start with the fungus gnat steps. If they swarm the fruit bowl, use our fruit fly guide and fruit fly trap instead.
Getting rid of fungus gnats
- Find the infested pots. Lay a slice of raw potato on the soil of each plant. University of Wisconsin horticulture says larvae come up to feed on it; check after 3 to 4 days.
- Let the soil dry. Wait until the top 1 to 2 inches are dry before watering again. Dry soil kills larvae and stops egg-laying.
- Water from the bottom. Set the pot in a tray of water for 15 to 30 minutes, then drain it, so the surface stays dry.
- Trap the adults. Push yellow sticky traps into the soil or hang them near the plants, and replace them when full.
- Treat the larvae. Water with a Bti product labeled for houseplants, repeating every 5 to 7 days for a few weeks.
- Cover the soil. Spread 1/2 to 1 inch of coarse sand or fine gravel on top to make it harder for gnats to lay eggs.
- Clean up. Remove dead leaves, empty saucers and repot badly soaked plants in fresh, well-draining mix.
Keep going for about 3 to 4 weeks. UC IPM says a generation can develop in about 17 days at 75°F, so stopping as soon as the adults disappear lets the next batch hatch.
Gnat traps and treatments compared
| Method | Works on | How to use | Notes |
|---|---|---|---|
| Yellow sticky traps | Fungus gnat adults | Stake near soil | Also shows how many you have |
| Drying the soil | Fungus gnat larvae | Top 1 to 2 inches dry | The single most important step |
| Bti drench (mosquito bits) | Fungus gnat larvae | Soak in water, use to water plants | Doesn't kill adults |
| Hydrogen peroxide drench | Fungus gnat larvae | 1 part 3% peroxide to 4 parts water | Test on one plant first |
| Sand or gravel top layer | Egg-laying adults | 1/2 to 1 inch on top | Keeps the surface dry |
| Apple cider vinegar trap | Fruit flies | Vinegar plus a drop of dish soap | Doesn't work on fungus gnats |
| Drain cleaning | Drain flies and drain-breeding gnats | Clean the trap, scrub the pipe walls | Removes the slime they breed in |
Cornell Cooperative Extension suggests the 1-to-4 hydrogen peroxide drench and letting the soil dry afterward. If you use an insecticide, choose one labeled for houseplants and follow the label.
Gnats coming from the drain?
The University of Maryland Extension notes that gnats can also breed in drains with moist debris. To check, it suggests covering the drain (or a suspect plant) with a screen or cheesecloth and watching for flies over the next several days. If the drain is the source, clean out the trap or use a drain cleaner, and scrub the inside of the pipe with a stiff drain brush to remove the slime. Our guides on how to unclog a drain and cleaning a shower drain cover the details.
Keeping gnats away
- Water less often. Water only when the top inch of soil is dry.
- Use drainage. Pick pots with holes and a well-draining potting mix, and empty saucers after watering.
- Check new plants. Look for gnats before you bring a plant home or inside for the winter.
- Store produce cold. Refrigerate ripe fruit and toss anything overripe.
- Take out the trash. Empty kitchen trash and rinse recycling often.
- Clean drains monthly. A quick scrub keeps drain flies from settling in.
Caring for houseplants that hate soggy soil? Our snake plant care guide covers how often to water.
Frequently asked questions
How do you get rid of gnats in the house fast? Find the source first, because gnats keep coming back until it is gone. For fungus gnats, let the top 1 to 2 inches of houseplant soil dry out and set yellow sticky traps by the pots; for fruit flies, toss overripe produce and set a vinegar trap; for drain flies, scrub the drain. Most gnat problems clear in 2 to 4 weeks.
Why do I have gnats in my house? Most indoor gnats are fungus gnats breeding in damp houseplant soil, especially overwatered pots or plants brought in from outside in the fall. Others are fruit flies drawn to ripe produce and trash, or drain flies breeding in slimy drains.
How can I tell fungus gnats from fruit flies? Fungus gnats are slim, dark gray, mosquito-like flies with long legs that hover around houseplants and windows. Fruit flies are tan or brown with red eyes and gather near fruit, trash and recycling. Drain flies are fuzzy, moth-like and rest on bathroom walls near drains.
Do vinegar traps work for gnats? Vinegar traps work for fruit flies, not fungus gnats. University of Wisconsin horticulture experts note that vinegar traps do not work for monitoring fungus gnats; use yellow sticky traps near the soil instead.
Does hydrogen peroxide kill fungus gnats? A mild hydrogen peroxide drench can kill fungus gnat larvae in soil. Cornell Cooperative Extension suggests 1 part 3% hydrogen peroxide to 4 parts water poured over the soil, then letting the soil dry out afterward. Test it on one plant first.
What is Bti and is it safe? Bti (Bacillus thuringiensis israelensis) is a natural soil bacterium that kills fungus gnat larvae, sold as mosquito bits, dunks and houseplant drenches. Extension services describe it as safe for plants and pets when used as labeled. It does not kill adults, so pair it with sticky traps.
Are gnats harmful? Fungus gnat adults do not bite people or damage plants, according to UC IPM; they are mostly a nuisance. Large numbers of larvae can damage the roots of seedlings and young plants in very wet soil.
How long does it take to get rid of fungus gnats? Expect about 3 to 4 weeks. A fungus gnat generation takes roughly 17 days at 75°F, so you need to keep the soil dry and keep trapping long enough to break the cycle, even after you stop seeing adults.
How do I keep gnats from coming back? Water houseplants only when the top inch of soil is dry, use pots with drainage holes and well-draining mix, empty saucers, remove dead leaves, and keep produce, trash and drains clean. Check new plants for gnats before bringing them inside.
Newsletter
Get the HomeBase email
Fresh tips three times a week, Mon/Wed/Fri, with our deals and new products, from printables, spreadsheets and bundles to paperback planners and apparel, plus simple home, money and planning tips.
Sources
- UC IPM: Fungus Gnats ipm.ucanr.edu
- University of Wisconsin Horticulture: Fungus Gnats on Houseplants hort.extension.wisc.edu
- University of Maryland Extension: Fungus Gnats extension.umd.edu
- Cornell Cooperative Extension: A Spooky Houseplant Pest, Fungus Gnats allegany.cce.cornell.edu
