Rodent & Pest Control

How to Get Rid of Gnats and Fruit Flies (Find the Breeding Source First)

Most small flying bugs in a kitchen or near a houseplant are not the same insect. Identify which one you have, find where it is breeding, and remove the breeding source. Spraying adults without doing that just keeps the cycle going.

Updated 2026-07-19.

The short answer

Identify which small fly you actually have, find its breeding source, and remove or clean that source. Spraying the adults you can see does almost nothing. Three different insects get called “gnats” in US homes, and they are not controlled the same way.

  • A fly in the kitchen that hangs around fruit or the trash and has bright red eyes is almost always a fruit fly. The breeding source is overripe produce, a damp mop, or a recycling bin.
  • A fly near a houseplant that is dark, mosquito-shaped, and runs across the soil when you water is a fungus gnat. The breeding source is the moist potting mix.
  • A small, fuzzy fly that rests on a bathroom or kitchen wall with its wings held roof-like over its body is a drain fly, also called a moth fly. The breeding source is the slime layer inside a drain.

A vinegar jar trap works on fruit flies and does nothing for drain flies or fungus gnats. That is why identification comes first.

Identify which one you are seeing

Fruit flies (Drosophila and other genera). About 1/8 inch long, dull tan to brownish yellow or brownish black, with bright red eyes (Maryland Extension and UC IPM). Weak fliers that hover around the fruit bowl, the compost pail, or a spill you missed. The whole cycle from egg to adult runs only about a week in a warm kitchen, which is why a population seems to appear overnight. Maryland Extension flags late summer and fall as the peak indoors.

Fungus gnats (Bradysia and Orfelia species). Smaller, darker, and more delicate than fruit flies, with long legs and antennae. UC IPM puts them at about 1/16 to 1/8 inch long with light gray to clear wings. They do not hover around fruit. They run across the surface of potting soil and fly up when you water. At 75 degrees F, UC IPM gives eggs hatching in about 3 days, larvae taking about 10 days to reach the pupal stage, and adults emerging about 4 days later, which is roughly a 17-day generation.

Drain flies or moth flies (Psychodidae). About 1/10 inch long, dark gray, with wings and body densely covered in hair so they look fuzzy (Penn State Extension). They rest on walls near sinks, tubs, and floor drains with their wings held roof-like over the body, and they are weak fliers that tend to stay put. Clemson HGIC notes they can be carried by wind up to about 300 feet.

Still not sure? Watch where the fly goes. Fruit flies land on produce, fungus gnats fly up from a pot, drain flies sit on the bathroom wall.

Find the breeding source first

The whole job is removing what the larvae feed on. The adults are the symptom. The larvae are almost always in one of three places:

  • In or on the food the adult is near. For fruit flies, check the fruit bowl, the onion basket, pantry potatoes, the compost pail, the recycling bin, and damp mop heads or dish rags. Maryland Extension notes “there may be enough food and moisture to complete development on damp mops or towels.”
  • In the potting mix of an overwatered houseplant. For fungus gnats, stick a finger into the soil of every plant in the room. If it stays wet for days after you water, that is the source.
  • In the slime layer inside a drain or P-trap. For drain flies, suspect any drain that is used infrequently, plus the bathroom sink, kitchen sink, laundry tub, and basement floor drain. Penn State Extension puts the source as “sinks and floor drains, or from nearby sewage plants or waste disposal areas,” and the habitat as the “gelatinous organic deposits” that build up inside drain pipes.

To confirm a drain, tape clear plastic sticky-side-down over the opening, or set a jar coated inside with petroleum jelly over it, and check over the next few days. Flies stuck in the jar mean that drain is the breeding site (Alabama Cooperative Extension).

How to eliminate each one

Fruit flies

Maryland Extension is direct: “The primary control for fruit flies is sanitation.” and “Eliminate larval food and development sites.” That is the whole plan:

  • Take produce off the counter, refrigerate fruit, and toss anything overripe or fermenting.
  • Empty the compost pail and kitchen trash nightly and rinse the cans.
  • Rinse bottles and cans before recycling, which Maryland Extension calls out specifically.
  • Wring out mop heads, dish rags, and sponges and stand them up to dry.
  • Clean the kitchen-sink drain with a stiff brush, as in the drain fly section below.

A homemade trap catches the adults already flying around: pour about an inch of apple cider vinegar into a jar, add a drop of dish soap to break the surface tension, cover the top with plastic wrap held by a rubber band, and poke a few small holes. USU Extension notes “vinegar traps or commercially produced fruit fly traps can catch flies that come indoors.” A trap only removes the adults you can see, so it is a supplement to sanitation, not a substitute.

Fungus gnats

UC IPM is clear that “physical and cultural management tactics, primarily the reductions of excess moisture and organic debris, are key,” and that insecticides are “rarely warranted” around homes.

  • Let the soil dry. Water only when the top inch or two is dry to the touch. NC State: “allowing the top inch of soil to dry out between waterings will disrupt their life cycle.” Bottom-watering keeps the surface dry, which is where adults lay eggs.
  • Use pots with drainage holes and empty the saucer so the plant is not sitting in water.
  • Repot with pasteurized potting mix, which UC IPM recommends because it lacks the fungus and organic matter the larvae eat.
  • Set yellow sticky traps in the pots to catch adults and show when the population is dropping. UC IPM suggests cutting them into small squares on skewers.
  • If it persists, treat the larvae. UC IPM and NC State both name Bti (Bacillus thuringiensis subspecies israelensis, sold as Mosquito Bits or Gnatrol) mixed into water, and the nematode Steinernema feltiae. Both target larvae, not adults, so use them alongside drying out the soil.

Most fungus gnat problems clear in two to three weeks once watering is dialed back. Letting a houseplant get nearly dry between waterings will not kill it.

Drain flies

Cleaning the drain is the fix. Penn State: “remove the organic material in which they breed.”

  • Scrub the inside of the drain opening and the visible part of the P-trap with a stiff brush to remove the biofilm. Penn State and Clemson HGIC both recommend mechanical cleaning.
  • Follow with an enzymatic or bacterial drain cleaner made to break down the slime layer, used per the label. Do not mix products, and never mix bleach with ammonia.
  • Skip the home remedies. Alabama Cooperative Extension is blunt: “pouring baking soda, bleach, vinegar, or boiling water down the drain is ineffective and may damage the drainpipe.” Alabama also warns against pouring insecticides down a drain to control drain flies.
  • Run water through every drain weekly, especially seldom-used ones, which Alabama recommends as prevention.
  • For a stubborn drain, a pest company can apply an insect growth regulator such as hydroprene or methoprene, reapplied every 2 to 4 weeks (Alabama Cooperative Extension).

A drain fly problem in one bathroom usually means one drain. The same problem in several rooms usually points to the sewer or septic line and needs a pro.

What not to do

  • Do not fog with a bug bomb or aerosol. The mist never reaches larvae inside a piece of fruit, a mop head, or a drain.
  • Do not assume the fly comes from outside. Sometimes it does, and a screen on the kitchen door helps (USU Extension), but most of the time it is breeding indoors.
  • Do not keep spraying a houseplant, especially herbs you eat.
  • Do not reach for bleach on a drain. It does not dissolve the biofilm and may damage the pipe.

When to call a pro

Most of these problems clear with a week or two of the steps above. Call a licensed pest professional if:

  • Drain flies keep returning after you have scrubbed and treated the drains. There may be a broken pipe under a slab or a problem in the sewer line.
  • Fruit flies keep appearing in a clean kitchen with no produce out, which points to a drain or a rarely cleaned spot like the fridge drip tray or the disposal splash guard.
  • Fungus gnats are damaging seedlings or cuttings, where repeat treatments help.

Keep them gone

Once the breeding source is gone, prevention is habit. Refrigerate fruit, take the trash out nightly, and rinse recycling. Water houseplants only when the top inch of soil is dry. Run every drain weekly, including the basement floor drain, and brush out sink drains monthly. Small flies are not a one-treatment problem. They are a find-the-source problem, and doing that once is what makes the kitchen go quiet.

Sources