The short answer
- Find the breeding source first. Killing the adults gives only temporary relief while larvae keep developing.[3][4]
- Fruit flies: eat, refrigerate or throw out ripe produce, empty and wash trash and recycling bins, and wipe up juice and drink spills. Then trap the leftover adults with a cider vinegar trap.[1][3][4]
- Drain flies: scrub the slime out of the drain with a stiff brush, or use a biological drain cleaner over several weeks. Bleach and chemical drain cleaners don't remove the film.[4][5][3]
- Fungus gnats: let the top 1 to 2 inches of houseplant soil dry between waterings. Bti drenches kill the larvae but need repeat applications.[7][6]
- Phorid flies that won't go away often come from a leaking or broken drain or sewer line, which has to be found and repaired.[8][4][5]
- Sprays and fogs only knock down the adults you can see. Don't pour insecticides down drains.[4][2][8]
Small fly profiles
Which small fly do you have?
Treatment depends on the fly, because each one breeds in a different place. Texas A&M says identifying the fly should be the first step in any control effort. Our types of house flies guide covers identification in detail and the small flies indoors guide covers where each one breeds; this page is about getting rid of them.[4]
- Fruit flies: about 1/8 inch long, usually with red eyes, hovering around fruit, trash and drinks.[1][3]
- Drain flies (moth flies): fuzzy and moth-like, about 1/16 to 3/16 inch, resting on walls near sinks and tubs and making short hopping flights. They turn to dust when swatted.[2][3]
- Fungus gnats: slender, mosquito-like black flies that stay near houseplants and gather at windows.[3][6]
- Phorid flies: about the size of fruit flies but humpbacked, with brown eyes. They tend to run across surfaces rather than fly, and they spread through a building more than fruit flies do.[3][4][8]
Step 1: Find the breeding source
Fly larvae can't develop without moisture, so look for anywhere water and organic debris collect. The University of Kentucky says that unless the breeding sites are removed or cleaned, the problem will continue no matter how often insecticides are applied to the adults.[4][1]
To test a drain or garbage disposal, tape a clear plastic food storage bag over the opening overnight, or invert a clear plastic cup lightly coated with vegetable oil or petroleum jelly over the drain for several days. Flies emerging from the drain end up in the bag or stuck in the cup.[1][2]
Texas A&M suggests a strip of clear packing tape across the drain instead. Don't cover the opening completely: with no airflow, flies may not emerge. Flies stuck to the tape mean you have found a source.[4]
Sticky traps placed around the house show where flies are most concentrated, which points to the breeding site.[3][8]
- Kitchen: overripe or damaged produce, especially bananas, and rotting onions or potatoes; the wet bottom of trash cans where liners have leaked; recycling bins; spills under the refrigerator.[4][1]
- Drains: sink, shower, tub and floor drains, garbage disposals, and toilets that are rarely used.[2][4][1]
- Appliances: refrigerator and air conditioner condensate pans, icemaker lines, and water under leaking refrigerators or washing machines.[4][2][3]
- Floors: cracked or loose tile, wet cracks in the floor, and the tracks of sliding glass doors.[4]
- Houseplants: wet potting soil, especially soil with a lot of peat or decaying plant matter.[6][7]
- Mops and cleaning rags, and empty bottles and cans.[1]
Fruit flies: produce, trash and spills
Fruit flies lay eggs on fermenting food and other moist organic material, and the University of Kentucky says a female will lay about 500 eggs. The life cycle from egg to adult can take about a week, so a forgotten source quickly produces a lot of flies.[1][3]
A single rotting potato or onion at the back of a closet, juice spilled under the refrigerator, or a basement recycling bin that is never emptied can breed thousands of fruit flies.[1]
- Eat, discard or refrigerate ripe produce. Don't leave bananas, tomatoes, pineapples or strawberries out once they're ripe.[1][4]
- Cut away cracked or damaged parts of fruits and vegetables and throw them out. The larvae feed near the surface, so you don't have to discard the rest.[1]
- Take out the trash, and empty and wash trash and recycling bins regularly. Check under the bag liner and use soap and water to remove residue.[4][3]
- Clean up spilled juice, syrup, wine and beer, including under appliances.[4][1]
- Seal home-canned food and homemade wine, cider or beer well. Fruit flies lay eggs under loose lids.[1]
- Fit windows and doors with tight 16 mesh screens.[1]
Vinegar traps and their limits
A trap is for the adults left after you remove the source. The University of Kentucky's version is a jar with a few ounces of cider vinegar and a paper funnel rolled from notebook paper set in the mouth. Another version is vinegar in a jar with a drop of dish soap so flies that land on it drown.[1][3][4]
Apple cider vinegar, wine, bananas, orange slices or apple cider all work as bait. A little yeast makes the bait more attractive, but fermenting baits can smell, and they may need replacing every few days.[4]
- Traps alone rarely give adequate control. Texas A&M says they are best used to pinpoint the source, to check whether your cleanup worked, or to reduce numbers while you find the breeding sites.[4]
- Put traps wherever fruit flies are seen.[1]
- Baited traps are mainly used for fruit flies. For phorid flies and fungus gnats the sources suggest sticky traps and cards, and for drain flies tape or a bag over the drain.[4][8][6][1]
Drain flies: clean out the biofilm
Drain fly larvae live in the gelatinous film of slime that builds up inside drains and feed on the algae, bacteria and fungi in it. Eggs are laid on that film, and the life cycle takes about 10 to 15 days at about 70° F.[4][5][2]
A few drain flies after you get back from a trip are usually temporary. The University of Kentucky says they tend to disappear soon after water starts moving through toilets and drain traps again. Many flies over several weeks means a lasting breeding site.[2]
- Scrub: clean pipes and traps with a stiff brush to remove the film, then flush the lines with hot to boiling water to carry away what's left.[4][5][2]
- Or use a biological or enzyme drain treatment that breaks down organic films. Texas A&M says these usually take repeat applications over several weeks. If you have a septic system, check that the product is compatible.[4][5][3]
- Don't count on bleach or chemical drain cleaners. Texas A&M calls them largely ineffective at removing the film, and Minnesota Extension says hot or boiling water, bleach and chemical drain cleaners are not effective.[4][5]
- Boiling water alone gives at most short-term control. Drain fly larvae are hard to drown because they trap air bubbles and can stay submerged for a day or more.[2]
- Clean the less obvious sites too: the slime line in rarely used toilet bowls and tanks, basement and garage floor drains, and drain pans under refrigerators.[2][4]
- Outdoors, drain flies can breed where air conditioners drain and in clogged gutters. Check those if flies don't seem to come from inside.[2]
- Don't pour insecticides down drains. If you use any insecticide, follow the label carefully.[2][3]
Fungus gnats in houseplants: dry the soil, then treat the larvae
Fungus gnat larvae live in the top 2 to 3 inches of moist potting soil and feed on fungi, algae, decaying plant matter and roots. Colorado State calls drying the growing medium between waterings, especially the top 1 to 2 inches, the most important step.[7][6]
Problems peak in late fall and winter, when plants use less water and potting soil stays wet longer. Plants brought in from outdoors for the winter often carry gnats with them.[7][4]
- Water less often and make sure pots drain well. Clean up standing water and fix leaks.[6][3][7]
- Check for larvae with 1/4 inch slices of raw potato pushed into the soil. Turn them over after a few days to look for larvae on the underside.[7][6]
- Repot plants when old potting mix has broken down and holds too much water, and remove decaying bulbs and roots. Use only pasteurized potting mix.[7][6]
- Yellow sticky cards set in pots catch adults and can cut down the next generation.[7][6]
- Bti (Bacillus thuringiensis subspecies israelensis) applied as a soil drench kills fungus gnat larvae. It doesn't persist indoors, so UC IPM says repeat applications at about five-day intervals may be needed. The Bt sold for caterpillars does not work on fly larvae.[6][7]
- Steinernema feltiae nematodes, applied as a drench, are another biological option and can give longer-term control.[6][7]
- Texas A&M says moving infested pots outdoors can eliminate the problem. Once gnats are established, drying the soil alone may not be enough, and the pot and soil may need to be treated or the soil replaced.[4]
Phorid flies and broken drain lines
Phorid flies breed in a wider range of decaying material than fruit flies, including garbage, drain pipes, broken garbage disposals and wet potting soil. Colorado State says the ones found in buildings are most often breeding in sites tied to plumbing.[4][8]
When drains are clean and the flies keep coming, suspect a leak. Soil soaked by a leaking sewer line under a building can produce severe indoor infestations. Minnesota Extension, writing about drain flies, which can also come from sewer line breaks, says confirming a break under a slab may mean breaking through the floor. Texas A&M says cleanup sometimes requires excavating the contaminated soil.[4][5]
- Use foaming drain cleaners or products that stick to the pipe for plumbing with pockets where debris collects. Colorado State says liquid cleaners poured down a drain can rush past those spots, and hot water or bleach are unlikely to clear them.[8]
- Repair the leak, and remove the material that escaped if you can. If it can't be removed, it will keep breeding flies until it is consumed or completely dry.[8]
- If the source is in a crawl space or under the foundation and can't be reached, dry the area thoroughly and caulk the points where flies get into living space.[8]
- Check under and behind refrigerators and washing machines for standing water from leaks.[3]
When sprays are pointless
Texas A&M says insecticides alone are rarely successful against indoor flies, and Colorado State says no insecticide use will help a phorid fly problem, because the flies you see are only the part of the population that has dispersed from the breeding site.[4][8]
Once the breeding sites are cleaned up, you shouldn't need insecticides. A pyrethrin aerosol or other flying-insect spray can knock down remaining adults, but it is temporary.[4][1]
- Fogs and space sprays may give temporary relief from fungus gnats but don't solve the problem. UC IPM advises against fogging indoors or spraying gnats in flight.[4][6]
- Sprays aimed at adult fungus gnats don't affect the larvae in the soil.[7]
- Most insecticides are not labeled for drains. The insect growth regulator S-hydroprene is an exception: it can be used in drains as a spray or foam, and it stops larvae from developing but doesn't kill adult flies.[4]
- A fly swatter or vacuum handles a few adults.[3][2]
Keeping them from coming back
- Store ripe produce in the refrigerator and keep trash and recycling bins emptied and clean.[1][3]
- Brush out sink and shower drains every so often, and run water through drains and toilets that sit unused.[4][2]
- Clean refrigerator and condensate drip pans, and fix plumbing leaks promptly.[4][6]
- Let houseplant soil dry between waterings, especially in fall and winter.[7]
- Keep window and door screens in good repair.[1][6]
Common questions
- What kills fruit flies fastest?
- Removing what they breed in. After that, a jar of cider vinegar with a paper funnel, or vinegar with a drop of dish soap, catches the adults that are left.[1][3]
- Does pouring boiling water down the drain kill drain flies?
- Not reliably. Hot water may give short-term control, but the larvae live in a slime film that water doesn't remove. Scrub the drain with a stiff brush first, then flush with hot to boiling water, or use a biological drain cleaner.[2][4][5]
- Will bleach get rid of drain flies?
- No. Texas A&M, Minnesota Extension and Colorado State all say bleach doesn't clear out the organic film the larvae live in.[4][5][8]
- How do I get rid of gnats in my houseplants?
- Let the top 1 to 2 inches of soil dry between waterings, use yellow sticky cards for adults, and drench the soil with Bti or beneficial nematodes if they persist.[7][6]
- Why do I still have flies after cleaning everything?
- There is likely a source you haven't found, such as a rarely used drain, a condensate pan, a cracked tile or a leaking pipe. Use tape or bags over drains and sticky traps to track it down.[4][1][8]
Photo credits
- Fruit Fly: Jesse Rorabaugh, public domain (CC0), via iNaturalist
- Drain Fly (Moth Fly): (c) Katja Schulz, some rights reserved (CC BY) — via iNaturalist, CC BY 4.0
- Fungus Gnat: (c) aispinsects, some rights reserved (CC BY) — via iNaturalist, CC BY 4.0
- Phorid Fly: (c) Justin Williams, some rights reserved (CC BY) — via iNaturalist, CC BY 4.0
Sources
- University of Kentucky Entomology, “ENTFACT-621: Fruit Flies.” entomology.mgcafe.uky.edu/ef621 (accessed 2026-11-10)
- University of Kentucky Entomology, “ENTFACT-615: Drain Flies or Moth Flies.” entomology.mgcafe.uky.edu/ef615 (accessed 2026-11-10)
- University of Kentucky Entomology, “ENTFACT-657: Small Flies in the Home.” entomology.mgcafe.uky.edu/ef657 (accessed 2026-11-10)
- Texas A&M AgriLife Extension, “Indoor Flies and Their Control.” agrilifeextension.tamu.edu/library/insects/indoor-flies-and-their-control/ (accessed 2026-11-10)
- University of Minnesota Extension, “Flies.” extension.umn.edu/garden-and-home/home-maintenance/household-insects/flies (accessed 2026-11-10)
- University of California Statewide IPM Program, “Pest Notes: Fungus Gnats.” ipm.ucanr.edu/home-and-landscape/fungus-gnats/ (accessed 2026-11-10)
- Colorado State University Extension, “Fungus Gnats as Houseplant and Indoor Pests.” extension.colostate.edu/topic-areas/insects/fungus-gnats-as-houseplant-and-indoor-pests-5-584/ (accessed 2026-11-10)
- Colorado State University, Department of Agricultural Biology, “Phorid Fly/Drain Fly (Colorado Insect of Interest).” webdoc.agsci.colostate.edu/bspm/arthropodsofcolorado/Phorid-Flies.pdf (accessed 2026-11-10)