How to Get Rid of Fruit Flies & Gnats
Quick answer: To get rid of fruit flies and gnats, first identify which one you have, because each breeds somewhere different. Fruit flies breed in overripe produce and sticky spills, fungus gnats in damp potting soil, and drain flies in the gunk inside drains. Remove or dry out that source, set an apple cider vinegar trap to catch the stragglers, and the swarm clears in one to two weeks.
Few things are as maddening as a cloud of tiny flies that appears out of nowhere and will not leave. You wipe the counters, take out the trash, and they are still hovering over the fruit bowl or drifting up from a houseplant the next morning. The reason they seem impossible to swat away is that killing the adults you see does almost nothing. For every fly in the air, there are eggs and larvae developing in a hidden breeding source, and until you find and eliminate that source, a fresh batch keeps emerging every few days.
The good news is that this is one of the most solvable pest problems there is, and in the vast majority of homes it is a do-it-yourself fix that costs almost nothing. The entire strategy comes down to three moves: figure out which insect you actually have, destroy the thing it is breeding in, and set a trap to catch the adults while the population dies off. This guide walks through each step, including the exact apple cider vinegar trap that works.
First, identify what you actually have
People lump every small flying insect together as a gnat, but three very different bugs cause almost all indoor complaints, and they breed in completely different places. Misidentifying yours is the single most common reason people spend weeks failing to get rid of them. The fastest way to tell them apart is not by looking at the insect, but by noticing where it hangs out, because that points straight to the breeding source you need to attack.
| Insect | Where you see it | Looks like | Breeds in | The fix |
|---|---|---|---|---|
| Fruit flies | Kitchen, fruit bowl, trash, recycling | Tan/brown, round body, often red eyes | Overripe produce, spills, fermenting liquid | Remove the produce and clean spills |
| Fungus gnats | Around houseplants, windows near plants | Tiny, dark, thin, mosquito-like | Damp potting soil (fungus on roots) | Let soil dry out; treat with BTI |
| Drain flies | Bathroom or kitchen sink, near drains | Fuzzy, moth-like, gray wings | Slime/gunk lining drain pipes | Scrub and clean the drain |
If the flies swarm the fruit bowl and trash can, they are fruit flies. If they rise up from your potted plants when you water or brush them, they are fungus gnats. If they cling to the wall near a sink or shower and look furry and moth-shaped rather than fly-shaped, they are drain flies. It is also common to have two at once, for example fruit flies in the kitchen and fungus gnats in the living room plants, so treat each source you find.
Find and destroy the source (this is the whole game)
Traps and sprays are supporting players. The one thing that actually ends an infestation is removing the moist, decaying material where the insects lay their eggs. A single overripe potato at the back of the pantry or a film of organic gunk in one drain can reseed the population indefinitely, so hunt for the source thoroughly before you rely on anything else.
For fruit flies: clear the kitchen
- Throw out or refrigerate overripe bananas, tomatoes, stone fruit, and anything soft or bruised sitting on the counter.
- Check for a forgotten potato, onion, or piece of produce that rolled behind an appliance or to the back of a cabinet.
- Empty the trash and recycling, then rinse the bins, fruit-fly eggs develop in the sticky residue at the bottom.
- Wipe up spills and sticky rings from juice, wine, beer, soda, vinegar, and sauce jars, including under the toaster and around the trash can.
- Take out compost daily and keep it sealed; run the garbage disposal and pour a little cleaner down it.
- Empty and rinse mop buckets, dish sponges, and recycling for beer and wine bottles, all classic breeding spots.
For fungus gnats: dry out the plants
Fungus gnat larvae feed on fungus and organic matter in constantly wet soil, so the fix is to make the soil an inhospitable place to breed. Overwatering is almost always the real cause.
- Let the top inch or two of soil dry out completely between waterings, larvae cannot survive in dry soil.
- Water from the bottom for a while so the surface, where gnats lay eggs, stays dry.
- Top the soil with a half-inch layer of coarse sand or fine gravel to block egg-laying.
- Treat the soil with a product containing BTI (Bacillus thuringiensis israelensis, sold as mosquito bits steeped in water or sprinkled on top), a natural larvicide that kills gnat larvae but is safe for people, pets, and the plant when used as directed.
- Toss any plant that is badly infested or sitting in chronically soggy soil, and check for hidden overwatered pots.
For drain flies: clean the drain
Drain flies breed in the gelatinous film of organic slime that builds up inside drain pipes. Pouring bleach down the drain mostly rinses past it and does not remove the film, so mechanical cleaning is what works.
- Confirm the drain is the source: dry the sink, tape a cup or plastic wrap loosely over the drain overnight, sticky side down, and check if flies are stuck to it in the morning.
- Scrub inside the drain and pipe with a stiff brush to physically break up the slime layer where eggs live.
- Follow with an enzyme-based drain cleaner (or a baking-soda-and-vinegar flush, then hot water) to digest remaining organic buildup, repeat over several days.
- Check every drain, including floor drains, laundry, and rarely-used guest bathrooms where slime accumulates undisturbed.
Set an apple cider vinegar trap
Once the source is handled, a simple trap mops up the remaining adults, especially fruit flies. Fruit flies are drawn to the smell of fermentation, and apple cider vinegar is essentially catnip to them. This trap costs pennies and works well as a supporting tactic, though it will never fix an infestation on its own if the breeding source is still there.
- Pour about half an inch of apple cider vinegar into a glass or jar (a splash of overripe fruit or a little wine or beer works too).
- Add one or two drops of dish soap and stir gently, the soap breaks the surface tension so flies sink instead of landing and escaping.
- Cover the top tightly with plastic wrap secured by a rubber band, then poke several small holes with a toothpick, or roll a paper cone into the jar with a small opening at the bottom.
- Set it near where the flies gather and leave it a few days; place two or three traps around the kitchen for a bad swarm.
- Refresh the vinegar every few days until you stop catching flies.
The apple cider vinegar trap catches adult fruit flies but does nothing to the eggs and larvae in the breeding source. If you set a trap and skip the cleanup, you will keep seeing new flies. Always remove the source first, then use the trap to clean up the survivors.
How long until they're gone?
Fruit flies go from egg to adult in about a week under warm conditions, which is why a problem can explode so fast, and also why it clears fairly quickly once the source is gone. Expect to keep seeing a few stragglers for one to two weeks as the last larvae finish developing and get caught in your traps. If you have removed every source you can find and the population is not shrinking after two weeks, you have almost certainly missed a breeding site or have a hidden plumbing issue.
Prevention: keep them from coming back
Once you have won, a few easy habits keep fruit flies and gnats from returning. They are opportunists that show up whenever there is fermenting food or chronically damp organic matter, so denying them both is the whole strategy.
- Store ripe fruit in the refrigerator and use or toss produce before it turns soft.
- Take out kitchen trash, compost, and recycling regularly, and rinse the bins so residue never builds up.
- Wipe counters and clean spills promptly, and don't leave dirty dishes or sponges sitting overnight.
- Run the garbage disposal often and flush drains with hot water or an enzyme cleaner every week or two.
- Water houseplants only when the top of the soil is dry, and empty saucers so pots never sit in standing water.
- Inspect fresh produce and new nursery plants before bringing them in, both can carry eggs from the store.
When it's a drain, plumbing, or pro problem
Most fruit fly and gnat problems are solved by cleaning in an afternoon. But a persistent infestation that keeps coming back after you have cleared every obvious source is a signal that the breeding site is somewhere you cannot easily reach. That often means the problem is inside your plumbing or structure rather than out on the counter.
- Drain flies that return no matter how much you scrub can indicate a deeper clog, a cracked or leaking pipe under a slab, or a dry P-trap in a rarely-used drain letting sewer gnats breed, worth a plumber's look.
- Small flies swarming persistently with no kitchen or plant source can point to a hidden moisture problem: a leak inside a wall or under cabinets, a sewage seepage issue, or decaying organic matter in a wall void.
- Phorid flies (humpbacked, fruit-fly-sized) breeding indoors are a known red flag for a broken sewer line or drain beneath the floor and usually need a plumber to locate the source.
- If the problem spans the whole house or you cannot locate the source at all, a pest professional can inspect, confirm the species, and identify the hidden breeding site.
If you have cleaned everything and the flies won't quit, it is reasonable to bring in help. A licensed pest control company can pinpoint an elusive source, and a plumber can address a drain or pipe issue behind the scenes. For what professional visits typically cost, see our pest control cost guide, and for the bigger picture on ongoing prevention, our guide to pest control services.
Fruit flies often travel with a wider gnat or moisture problem. If you are also fighting drain-loving pests or seeing insects around damp areas, our guide on how to get rid of cockroaches covers the same source-first approach for a tougher kitchen invader.
Ready to hand it off? Compare license-verified pest control pros near you and request one exclusive quote, no obligation, no phone tree.
Frequently asked questions
Why do I suddenly have fruit flies?
Fruit flies appear suddenly because a single piece of overripe or fermenting produce, or a sticky spill, gives them a place to lay eggs, and they go from egg to adult in about a week. Eggs also hitchhike in on fruit and vegetables from the store, then hatch on your counter. Find and remove the source and the swarm clears within a week or two.
How do I make an apple cider vinegar trap for fruit flies?
Pour about half an inch of apple cider vinegar into a jar, add a drop or two of dish soap so flies sink instead of escaping, then cover the top with plastic wrap and poke a few small holes. Set it where the flies gather and refresh the vinegar every few days. It catches adults, but you must still remove the breeding source or new flies keep appearing.
What's the difference between fruit flies, fungus gnats, and drain flies?
They breed in different places, which is the key to getting rid of them. Fruit flies swarm overripe produce and trash in the kitchen. Fungus gnats are thin, dark, and rise from the damp soil of houseplants. Drain flies are fuzzy and moth-shaped and cling to walls near sinks, breeding in the slime inside drains. Identify yours by where it gathers, then target that source.
How do I get rid of gnats in my houseplants?
Those are usually fungus gnats, and they breed in wet potting soil. Let the top inch or two of soil dry out fully between waterings, water from the bottom, and top the soil with coarse sand to block egg-laying. Treating the soil with a BTI product (mosquito bits) kills the larvae and is safe for the plant, pets, and people when used as directed.
Why do fruit flies keep coming back after I clean?
Because a breeding source remains that you haven't found. Common culprits are a forgotten potato or onion, residue in the bottom of the trash or recycling bin, a sticky spill under an appliance, gunk in the garbage disposal or drain, or an overwatered plant. Hunt down every damp, food-related source; if they still return, the source may be inside a drain or wall.
How do I get rid of drain flies?
Drain flies breed in the film of organic slime inside drain pipes, so bleach alone won't work because it rinses past the film. Scrub inside the drain with a stiff brush to physically remove the slime, then use an enzyme drain cleaner over several days. Confirm the source first by taping a cup over the dry drain overnight and checking for trapped flies in the morning.
How long does it take to get rid of fruit flies?
Once you remove the breeding source and set traps, expect to keep seeing a few stragglers for one to two weeks as the last larvae mature and get caught. If the population isn't clearly shrinking after two weeks, you've missed a source, check drains, disposals, recycling, and any overwatered plants.
When should I call a professional for fruit flies or gnats?
Most cases are a DIY cleanup. Call a pro if the flies keep returning after you've cleared every obvious source, which can signal a hidden breeding site inside a drain, wall, or under the floor. Persistent drain flies or humpbacked phorid flies indoors can indicate a broken sewer line or leak, worth a plumber or pest professional to locate.