Getting rid of fruit flies and gnats comes down to two things: eliminating where they breed and trapping the adults already flying around. Most home infestations clear up within one to two weeks when you attack both at once. But the right approach depends on which pest you’re actually dealing with, because fruit flies, fungus gnats, and drain flies breed in completely different places.
Identify What You’re Dealing With
People use “gnats” as a catch-all, but the tiny flies in your home are almost always one of three species, and each one needs a different fix.
- Fruit flies are about 1/8 inch long with stout, rounded bodies and distinctive red eyes. They hover around ripe fruit, compost bins, and anything fermented. A single female can lay 400 to 500 eggs in just 10 days, and a new generation goes from egg to adult in as little as 10 days at warm room temperature. That’s why a couple of fruit flies can become hundreds seemingly overnight.
- Fungus gnats are mosquito-like with long, slender legs and dark wings. They don’t bite. You’ll see them rising from the soil of houseplants or hovering near windows. Their larvae are tiny white worms that feed on plant roots and fungi in damp potting mix. A full generation completes in about 17 days.
- Drain flies are fuzzy, moth-shaped flies that rest on walls near sinks and showers. Their larvae live in the slimy organic film that builds up inside pipes.
If flies cluster around your fruit bowl, start with fruit fly solutions. If they rise from plant pots when you water, you have fungus gnats. If they appear near drains and disappear when you haven’t used a sink in a while, drain flies are the culprit. Many homes have more than one type at once.
How to Get Rid of Fruit Flies
Remove Their Food Source
Traps alone won’t solve a fruit fly problem if the breeding site stays active. Move ripe fruit and vegetables into the refrigerator. Cold temperatures stop fruit fly development entirely. Toss any overripe or damaged produce, empty kitchen compost bins daily, and clean up spills of juice, wine, or vinegar. Check under and behind appliances for forgotten food scraps, because even a single rotting grape wedged behind a toaster can sustain a colony.
Set a Vinegar Trap
The simplest and most effective DIY fruit fly trap uses apple cider vinegar and dish soap. Pour about half an inch of apple cider vinegar into a jar or bowl, then add two or three drops of dish soap. The vinegar’s fermented scent draws fruit flies in. Normally they could land on the liquid’s surface and fly away, but the soap breaks the surface tension, so they sink and drown instead. Place traps near problem areas and replace the liquid every two to three days. You can also cover the jar with plastic wrap and poke small holes in it, which lets flies enter but makes escape harder.
White vinegar doesn’t work nearly as well. Apple cider vinegar mimics the smell of fermenting fruit, which is specifically what attracts these flies. Red wine or overripe banana pieces placed in a jar with a paper funnel entrance are effective alternatives.
Clean Your Drains
Fruit flies also breed in the organic gunk inside kitchen sink drains. Even if drain flies aren’t your main problem, cleaning drains removes a secondary breeding site. Pour boiling water down each kitchen drain, then follow up with an enzyme-based drain cleaner. Enzyme cleaners break down the organic sludge that flies lay eggs in, which bleach doesn’t fully accomplish.
How to Get Rid of Fungus Gnats
Dry Out the Soil
Fungus gnat larvae need moist soil to survive. The single most important step is letting the top inch or two of potting mix dry out completely between waterings. This kills existing larvae and makes the soil inhospitable for new eggs. Many houseplants tolerate this drying period well, though you’ll want to adjust for species that need consistently moist soil.
Use a Hydrogen Peroxide Soil Drench
For a more aggressive approach, mix one part standard 3% hydrogen peroxide with four parts water and pour it directly over the soil. The solution fizzes on contact, killing larvae without harming plant roots. Let the soil dry out afterward. One or two treatments a week apart typically clears an infestation.
Place Yellow Sticky Traps
Yellow sticky cards are the single most useful trap for fungus gnats. These insects are drawn to yellow at a specific wavelength (around 580 nanometers) that mimics the reflectance of stressed plant tissue. A yellow sticky stake placed in the soil of each infested pot catches adult gnats before they can lay more eggs, breaking the breeding cycle. Blue or clear cards barely register with them.
UV light traps, by contrast, are much weaker on fungus gnats. UV traps work well for house flies and mosquitoes, which orient toward ultraviolet light after dark, but fungus gnats respond to color, not UV. Save those for a different pest.
How to Get Rid of Drain Flies
Drain flies breed in the bacterial film inside pipes, so killing adults without cleaning the drain just leads to a new wave in a few days. Start by scrubbing the inside of the drain with a stiff pipe brush to physically remove the sludge layer where eggs are laid. Then flush with boiling water to kill remaining larvae and loosen organic matter.
For ongoing maintenance, enzyme-based drain cleaners are more effective than bleach. Bleach may kill some larvae on contact, but it flows past the sticky biofilm without fully removing it. Enzyme cleaners actively digest the organic buildup that drain flies depend on. A combination of baking soda followed by vinegar, then boiling water, can also help break down lighter buildup. Repeat cleaning every few days for about two weeks to outlast the breeding cycle.
Why You Need Traps and Source Removal Together
Trapping adults without eliminating breeding sites is like bailing water without plugging the leak. A fruit fly that escapes your vinegar trap can lay 50 to 75 eggs per day. Conversely, removing the food source alone still leaves you waiting for all the existing adults to die off naturally. Using both strategies simultaneously, you cut off new generations while reducing the current population. Most infestations resolve within one to two weeks with this combined approach.
Preventing Them From Coming Back
Wash all produce as soon as you bring it home. Fruit fly eggs are often already on the skin of store-bought fruit, and washing removes them before they have a chance to hatch in your kitchen. Store fruits and vegetables in the refrigerator whenever the item allows it.
Clean garbage cans regularly to remove the sticky residue that accumulates at the bottom. Take out trash and recycling before bins overflow, especially in warm weather. Rinse bottles and cans before tossing them in recycling.
For fungus gnats, avoid overwatering houseplants and use well-draining potting mix. Some gardeners add a half-inch layer of sand or decorative gravel on top of the soil, which dries out quickly and discourages egg-laying. For drain flies, run water through infrequently used drains at least once a week and clean drains with an enzyme treatment monthly. Eliminating excess moisture throughout your home, fixing leaky pipes, and drying out damp areas under sinks removes the conditions all three of these pests need to thrive.