How to Get Rid of Gnats: Complete Guide for Homeowners
Last updated: March 4, 2026
Knowing how to get rid of gnats starts with figuring out which type of gnat you are dealing with, because the treatment differs depending on the species. The small flying insects homeowners call gnats are often fungus gnats, drain flies, fruit flies, or phorid flies, and each one breeds in a different location. Treating the wrong source will not solve the problem. This guide walks through identification, breeding source elimination, DIY methods, and when professional help is the right call.
For a broader look at pest control costs and service options, see our pest control cost guide.
Identifying the Type of Gnat
The word "gnat" covers several different small fly species. Before treating, spend a few minutes observing where the flies congregate and what they look like. This narrows down the species and points you toward the right breeding source.
Fungus gnats
Fungus gnats are the most common indoor gnat for homeowners with houseplants. They are small (about 1/8 inch), dark gray or black, and have long, dangling legs visible in flight. Adult fungus gnats hover near soil and are drawn to light. The larvae live in the top two inches of moist potting soil, where they feed on organic matter and plant roots. Overwatered houseplants are the primary culprit in nearly every fungus gnat infestation.
Drain flies
Drain flies (also called moth flies) are slightly larger, fuzzy-looking, and have a distinctly moth-like appearance with broad, rounded wings held tent-like over their body. They rest on walls near sinks, showers, and floor drains. Larvae breed in the organic slime that builds up inside drains, pipes, and garbage disposals. A drain fly infestation almost always points to slow-moving or neglected drains with buildup inside.
Fruit flies
Fruit flies are tan or brown with bright red eyes and are slightly smaller than a common housefly. They swarm around overripe or rotting fruit, fermented liquids, and food residue. Fruit flies breed in any moist organic material that is fermenting, including fruit bowls, recycling bins, mop heads, and drip trays under refrigerators. They are most prevalent in late summer and fall when fresh produce is abundant.
Phorid flies
Phorid flies (also called humpbacked flies) are small and brown with a distinctive humped thorax. They run rapidly across surfaces rather than flying continuously. Phorid flies are the most concerning of the four species because they can breed in decomposing organic matter associated with plumbing breaks, sewage leaks, or dead rodents inside walls. If phorid flies appear suddenly and in large numbers with no obvious food source nearby, a hidden plumbing or sanitation issue may be the cause.
| Gnat Type | Appearance | Where Found | Breeding Source |
|---|---|---|---|
| Fungus gnat | Small, dark gray/black, long legs | Near houseplants, windows | Moist potting soil |
| Drain fly | Fuzzy, moth-like, rounded wings | Near sinks, showers, drains | Organic slime inside drains |
| Fruit fly | Tan/brown, red eyes | Near fruit, trash, recycling | Rotting fruit, fermented material |
| Phorid fly | Brown, humped thorax, runs on surfaces | Near drains, floors, walls | Sewage, decomposing matter |
Finding the Breeding Source
Trapping and killing adult gnats provides temporary relief but will not eliminate an infestation. Adults live only a few days, but larvae continue hatching from the breeding source. Locating and eliminating that source is the only way to end the cycle.
Overwatered houseplants
Check all houseplants for soggy soil. Push a finger two inches into the soil; if it is still damp, the plant has been watered too recently. Fungus gnat larvae need consistently moist soil to survive. Allowing soil to dry out completely between waterings is often enough to collapse the population within two to three weeks, since larvae cannot survive in dry conditions.
Drains and garbage disposals
Pour a cup of water slowly down each drain and observe whether any small flies emerge. Check bathroom sinks, shower drains, floor drains in the basement or laundry room, and the garbage disposal. Drain flies and fruit flies can both breed in the organic film that lines the inside of pipes, especially in drains that receive little regular use. Standing water in a rarely used basement drain is a particularly common source.
Rotting produce and food waste
Inspect fruit bowls for overripe or rotting fruit. Check the bottom of produce drawers in the refrigerator for forgotten vegetables. Look under and behind appliances for food debris or drip trays with standing liquid. Recycling bins that are not rinsed regularly are a frequent breeding site for fruit flies. Even a single piece of rotting fruit can sustain a large fruit fly population.
Hidden moisture sources
If you cannot find an obvious breeding source, look for hidden moisture. Condensation drip trays under refrigerators and freezers, water in the drip pan of a dehumidifier, leaky pipes under sinks, and water-damaged subfloor material can all support gnat breeding. Phorid flies in particular may indicate a more serious plumbing failure or pest carcass that is not visible without inspection.
DIY Methods to Get Rid of Gnats
Once you have identified the breeding source and begun addressing it, these methods reduce the adult population and speed up the elimination process. Use them in combination for best results.
Apple cider vinegar trap
Pour a small amount of apple cider vinegar into a glass or bowl, add a drop of dish soap, and cover with plastic wrap secured with a rubber band. Poke several small holes in the plastic wrap. The vinegar smell attracts fruit flies and fungus gnats, the dish soap breaks the surface tension so they sink, and the plastic wrap traps them inside. Place traps near the breeding source and check them daily. Replace every two to three days or when full.
Hydrogen peroxide soil drench for fungus gnats
Mix one part 3% hydrogen peroxide (standard drugstore concentration) with four parts water. Water affected houseplants with this solution until it drains from the bottom. The fizzing reaction kills fungus gnat larvae on contact while leaving the plant unharmed at this dilution. Repeat every five to seven days for two to three weeks to interrupt the full breeding cycle. Allow soil to dry between treatments.
Enzyme drain gel for drain flies
Commercial enzyme drain gels (available at hardware stores) break down the organic slime inside pipes that drain flies breed in. Pour the recommended amount down affected drains at night when the drain will not be used, giving the enzyme gel time to work. Repeat daily for one to two weeks for active infestations. Physical cleaning with a drain brush first improves results by removing thick buildup before applying the gel.
Removing attractants
Store ripe fruit in the refrigerator rather than on the counter. Keep trash cans covered with tight-fitting lids and empty them frequently. Rinse recycling containers before placing them in the bin. Clean up food spills promptly, including liquid spills around appliances. Eliminating food and fermentation sources is especially effective for fruit fly control and reduces the breeding population faster than traps alone.
Sticky yellow traps
Sticky yellow traps catch flying adult gnats on contact. They are particularly effective for fungus gnats when placed on the soil surface of affected houseplants or on a stake inserted into the pot. The yellow color attracts fungus gnats, and the adhesive holds them. Yellow traps also help monitor infestation severity, since a drop in trapped adults indicates the breeding source is being controlled.
Bacillus thuringiensis var. israelensis (Bti)
Bti is a naturally occurring soil bacterium sold in granular or liquid form (commonly as Gnatrol or Mosquito Bits). When applied to houseplant soil or standing water, it kills fungus gnat larvae selectively without harming plants, pets, or beneficial insects. It is one of the most effective and low-risk treatments available for fungus gnats. Bti can also reduce mosquito larvae in outdoor standing water. For more on mosquito control, see our guide on how to get rid of mosquitoes.
When Gnats Indicate a Moisture or Plumbing Issue
A persistent gnat infestation that does not respond to standard DIY treatment often points to a structural or plumbing issue rather than a simple sanitation problem. This is especially true for drain flies and phorid flies.
Phorid flies breeding in large numbers without an obvious food source near drains or trash are a significant warning sign. They can breed in sewage leaks behind walls, broken drain lines beneath slabs, decomposing rodent carcasses inside wall voids, or leaking wax ring seals beneath toilets. These sources cannot be addressed without professional inspection and often require a plumber in addition to a pest control technician.
Drain flies that persist despite weekly enzyme gel treatments may indicate a slow or partial drain blockage that retains standing organic matter deep in the pipe, beyond what a gel can reach. A plumber can camera inspect the line and identify blockages or cracks. Water-damaged subfloor material from a slow leak can also sustain gnat breeding long after the leak itself is repaired, since wet wood and insulation take weeks to dry completely.
If you have treated all visible sources and gnats continue to appear, consider having both a plumber and a pest control professional inspect the property. For guidance on deciding whether professional intervention is needed, see our guide on when to call an exterminator.
Professional Treatment for Severe Infestations
Professional treatment is warranted when gnats persist after four to six weeks of consistent DIY efforts, when phorid flies suggest a plumbing or sanitation issue, or when the breeding source cannot be located or accessed by the homeowner. Professionals have access to commercial-grade products and equipment that are not available to the public.
| Treatment Type | Description | Cost Range |
|---|---|---|
| Drain inspection and treatment | Camera inspection of drain lines followed by commercial enzyme or microbial treatments to eliminate breeding sites | $150 – $350 |
| Soil drench application | Professional-grade Bti or insect growth regulator applied to houseplant soil to kill fungus gnat larvae | $75 – $150 |
| Interior residual spray | Targeted insecticide applied to breeding areas and resting surfaces to reduce adult gnat populations quickly | $100 – $250 |
| Plumbing leak investigation | Inspection for broken drain lines, sewage leaks, or moisture sources driving phorid fly or drain fly infestations | $200 – $500+ |
Most pest control companies will perform a thorough inspection to identify breeding sources before recommending a treatment plan. For general pest control pricing context, visit our pest control cost guide.
Prevention Tips
Most gnat infestations are preventable with consistent household habits. The following steps address the conditions that allow gnats to establish a breeding population.
- Water houseplants only when the top two inches of soil are dry. Fungus gnats cannot survive in dry soil. Adjusting your watering schedule is the single most effective prevention measure for the most common indoor gnat species.
- Run drains regularly and treat them monthly. Drains that sit unused develop organic buildup quickly. Running hot water for 30 seconds and following up with an enzyme drain cleaner once a month keeps buildup from accumulating to a level that supports breeding.
- Store ripe produce in the refrigerator. Fruit flies cannot breed in cold environments. Moving fruit to the refrigerator once it begins to ripen eliminates one of the primary attractants for the most common warm-season gnat.
- Empty trash cans at least twice per week. Food waste ferments quickly, especially in warm kitchens. Frequent trash removal reduces the organic material available for fruit fly and drain fly breeding. Use a trash can with a tight-fitting lid.
- Rinse recycling containers before storage. Residue inside beverage containers ferments and attracts fruit flies. A quick rinse before placing items in the recycling bin removes most of the attractant.
- Fix dripping faucets and slow drains promptly. Persistent moisture under sinks and slow-moving drains are a setup for gnat breeding. Addressing plumbing issues early prevents the conditions that support infestations.
- Inspect new potting soil before use. Some potting mixes are sold with fungus gnat eggs already present. Inspect soil for small, rice-like white larvae near the surface and consider using sterile potting mix or pasteurized soil for new plantings.
Frequently Asked Questions
Get Pest Control Pricing Estimates
Connect with top-rated local pros. Compare prices and save.
No-obligation pricing estimates. Your information is secure.