How to Get Rid of Gnats: Every Method That Actually Works
Gnats are a frustratingly broad category of small flying insects, and getting rid of them effectively starts with figuring out which specific type you’re actually dealing with, since fungus gnats, fruit flies, and drain flies all get casually called “gnats” but require somewhat different elimination approaches depending on where and how they’re breeding in your home.

Identifying What Type of Gnat You Have
Fungus gnats are small, dark, mosquito-like flying insects most commonly found around houseplants, since they breed in consistently moist potting soil and feed on fungus and organic matter in that soil. If your gnat problem is concentrated around your plants specifically, this is almost certainly what you’re dealing with.
Fruit flies are smaller, often with a tan or reddish-brown coloring, and are drawn to fermenting fruit, vegetables, and other organic matter in your kitchen specifically — typically the source of “gnats” people notice hovering around a fruit bowl or kitchen trash.
Drain flies (sometimes called moth flies due to their fuzzy, moth-like appearance under close inspection) breed in the organic buildup inside drains and are most commonly noticed in bathrooms and kitchens near sinks, showers, and floor drains.
Correctly identifying which type you have meaningfully changes your elimination strategy, since treating a drain fly problem with houseplant-focused solutions, for example, won’t address the actual breeding source.
Getting Rid of Fungus Gnats (Houseplant Gnats)
Let soil dry out between waterings. Fungus gnat larvae need consistently moist soil to survive, and allowing the top one to two inches of soil to dry out fully between waterings disrupts their breeding cycle significantly, often resolving a mild infestation without any additional intervention needed.
Use yellow sticky traps. Small yellow sticky cards placed in the soil of affected plants attract and trap adult fungus gnats, both reducing the current population and helping you monitor whether your other interventions are working over time.
Apply a layer of sand or diatomaceous earth on top of the soil. A thin top layer of coarse sand, or food-grade diatomaceous earth, makes it physically harder for adult gnats to lay eggs in the soil and can help dehydrate larvae present near the surface.
Use a BTI (Bacillus thuringiensis israelensis) product. Sold specifically as “mosquito bits” or similar products at garden centers, BTI is a naturally occurring bacteria that specifically targets fungus gnat larvae (along with mosquito larvae) when watered into the soil, without harming your plants or posing risk to pets or people.
Repot severely affected plants if the infestation is significant and persistent despite other interventions, replacing the old, contaminated soil entirely with fresh potting mix.
Getting Rid of Fruit Flies (Kitchen Gnats)
Eliminate the breeding source first. Check for overripe produce, residue in drains, unrinsed recycling containers, and any other organic matter that could be sustaining a breeding population, since trapping adults without addressing this source means new flies will continue emerging.
Set vinegar traps. Apple cider vinegar in a small bowl, with a few drops of dish soap to break the surface tension, covered loosely with plastic wrap with small holes poked in the top, is one of the most consistently effective DIY trapping methods for this specific type of gnat.
Clean drains thoroughly, since drain residue is a commonly overlooked fruit fly breeding source even when your visible food storage practices seem adequate.
Getting Rid of Drain Flies
Clean the drain thoroughly using a drain brush specifically designed to reach and physically scrub the inner walls of the pipe, since liquid treatments alone often don’t fully remove the organic film buildup these flies breed in.
Pour boiling water followed by a baking soda and vinegar mixture down affected drains, letting it sit for 10-15 minutes before flushing with more boiling water, as routine maintenance even after you’ve addressed the immediate visible problem.
Use a drain gel cleaner specifically formulated for organic buildup, available at most hardware stores, which can be more effective than basic household remedies for established, stubborn buildup.
Check for any cracked or leaking pipes if the problem persists despite drain cleaning, since drain flies can sometimes breed in moisture accumulating in less visible spots like under sinks or around pipe joints rather than just within the visible drain opening itself.
General Prevention Tips Across All Gnat Types
Maintain proper plant watering habits, allowing appropriate drying time between waterings rather than keeping soil consistently saturated, which is the single most impactful preventive measure against fungus gnats specifically.
Store ripening produce in the refrigerator once it reaches peak ripeness, and don’t leave cut or peeled fruit sitting out for extended periods.
Take out trash and recycling regularly, rinsing any containers that held food or beverages before placing them in recycling bins.
Run drains regularly even when not in active use, since infrequently used drains (a guest bathroom, for example) are more prone to developing the kind of organic buildup that breeds drain flies specifically.
Address moisture issues promptly, whether that’s a slow leak, condensation buildup, or overwatered plants, since virtually all gnat varieties depend on consistent moisture to breed successfully, making moisture control a unifying preventive theme across every specific gnat type covered here.
When to Consider Professional Pest Control
If you’ve worked through identification, source elimination, and trapping methods across multiple weeks without meaningful improvement, particularly for a drain fly or fungus gnat problem that keeps recurring despite your best efforts, it may be worth consulting a professional pest control service. This is especially true if you suspect the breeding source might be in a less accessible location, such as within wall cavities near a slow plumbing leak, or in a crawl space with consistently damp conditions that are difficult to fully address through standard household interventions alone.
A professional inspection can sometimes identify breeding sources that aren’t obvious through typical homeowner troubleshooting, and persistent gnat problems despite genuine effort at source elimination are sometimes a sign of an underlying moisture or plumbing issue that needs more thorough investigation than surface-level pest treatment alone would address.
Key Takeaways
- Correctly identifying which type of gnat you’re dealing with — fungus gnats (houseplants), fruit flies (kitchen produce), or drain flies (plumbing) — is the essential first step, since each requires a different elimination approach
- Fungus gnats are best addressed by allowing soil to dry between waterings, using yellow sticky traps, applying a sand or diatomaceous earth top layer, and treating with BTI products for persistent infestations
- Fruit flies require eliminating the actual breeding source (overripe produce, drain residue, unrinsed recycling) combined with vinegar-based traps to clear the existing adult population
- Drain flies need thorough physical drain cleaning with a drain brush, not just liquid treatments, since the organic buildup they breed in often requires direct scrubbing to fully remove
- Moisture control is the unifying prevention theme across all gnat types: proper plant watering habits, prompt leak repair, and regular drain use and maintenance all reduce the consistently moist conditions every gnat variety depends on to breed
- If a gnat problem persists despite addressing the obvious likely source, recheck for a less visible breeding spot rather than assuming more aggressive trapping alone will resolve a problem with an unaddressed underlying cause