Fruit Flies in Your Trash Can: How to Get Rid of Them

Fruit flies show up in your trash can because it offers exactly what they need: fermenting organic material and moisture. Even a thin film of residue from old food is enough for them to feed and lay eggs. The good news is that a combination of cleaning, trapping, and a few habit changes can eliminate them within a week or two.

Why Fruit Flies Target Your Trash Can

Fruit flies are drawn to the smell of ripening and rotting organic matter. Banana peels, potato scraps, onion skins, and any vegetable trimmings release fermentation odors as they break down, and fruit flies can detect those chemical signals from surprising distances. Your trash can concentrates all of those odors in one warm, moist space.

The flies don’t just feed there. They breed there. Females lay eggs directly on the surface of fermenting material, and a single female can deposit up to 500 eggs in her lifetime. Those eggs hatch into tiny larvae that feed on the decomposing layer coating the inside of your bin. In summer temperatures, the full cycle from egg to adult takes only 8 to 10 days. New adults mate within hours of emerging and start laying eggs about 24 hours later. That’s why a couple of fruit flies can become dozens in under two weeks.

The problem peaks in late summer and fall, when warmer temperatures speed up both fermentation and fly development. But fruit flies can be a year-round issue indoors, especially if your kitchen stays warm and your trash sits for more than a day or two.

Make Sure They’re Actually Fruit Flies

Not every tiny fly near your trash is a fruit fly. Two common lookalikes, phorid flies and drain flies, require different solutions. Fruit flies are small (about an eighth of an inch), tan or brownish, and have distinctive red eyes. If the flies near your trash have red eyes, you’re dealing with fruit flies.

Phorid flies look similar in size but lack the red eyes and have a noticeable hump on their back between the head and abdomen. Their most telling behavior: they prefer running erratically across surfaces rather than flying, which is why they’re sometimes called “scuttle flies.” Drain flies, by contrast, are fuzzy and moth-like, and they hover near sink drains rather than food. If your flies match the phorid or drain fly description, the trash can may not be the real source of the problem.

How to Clean Out an Infested Trash Can

Traps alone won’t solve the problem if your trash can is already hosting eggs and larvae. You need to break the breeding cycle at the source. Start by emptying the can completely, including removing any liquid or residue pooled at the bottom.

Scrub the interior with hot, soapy water. Pay attention to the lid, the rim, and any crevices where organic film can accumulate. For a stronger treatment, use a diluted bleach solution: about a third of a cup of bleach per gallon of water. You can also soak a paper towel in the bleach solution, place it inside the closed trash can, and let the fumes work for 30 minutes to an hour. This kills larvae and eggs without heavy scrubbing. Rinse the can thoroughly afterward and let it dry completely before putting a new bag in. Moisture left behind just invites the flies back.

Trapping the Remaining Adults

After cleaning, you’ll likely still have adult flies buzzing around your kitchen. Adults can live 45 to 60 days under favorable conditions, so you need to catch the ones already out. The simplest trap uses apple cider vinegar: pour about a quarter cup into a jar and add a few drops of liquid dish soap. The vinegar’s fermentation smell attracts the flies, and the soap breaks the surface tension of the liquid so they sink and drown instead of landing and flying away.

Place the trap near your trash can or wherever you see the most activity. You can also use a slice of overripe banana or a splash of red wine as bait. Some people cover the jar with plastic wrap and poke small holes in it to let flies in but make escape difficult. Either approach works. Expect to see results within the first day, though it may take a week or more to catch the last stragglers as remaining eggs hatch into new adults.

Preventing Them From Coming Back

The single most effective prevention step is limiting how long food scraps sit in your trash. Holding only one to two days’ worth of food waste in your kitchen bin dramatically cuts the odor and moisture that attract fruit flies. If you can’t take the trash out that often, tie off your trash bag tightly when it’s not in use and make sure your bin has a secure, well-fitting lid. A loose lid is an open invitation.

Moisture is the other key factor. Fruit flies need a moist film of organic material to breed, so anything that dries out your trash helps. Wrapping wet food scraps in newspaper or a paper towel before tossing them absorbs excess liquid and contains the fermentation smell. A light sprinkle of diatomaceous earth over the scraps works the same way. These “dry layers” between food waste make the environment far less hospitable.

Rinse your trash can with hot, soapy water between bag changes, even when it looks clean. Invisible residue left by a leaking bag is enough to sustain a breeding population. If you use a compost bin on your counter, the same rules apply: secure lid, frequent emptying, and a rinse between loads. Keep ripening fruit in the refrigerator rather than on the counter during peak fruit fly season. Cold storage slows larval development enough to prevent the problem from starting.

Why They Seem to Appear Out of Nowhere

One of the most frustrating things about fruit flies is how fast an infestation builds. You go from seeing one or two to a cloud of them in what feels like overnight. The math explains it: with a 8-to-10-day generation time and up to 500 eggs per female, a single pregnant fly that hitches a ride home on your grocery produce can seed an entire infestation before you notice anything. By the time you see adults flying around, there are already eggs and larvae developing in your trash can, drain, or on that forgotten piece of fruit on the counter.

The flip side is that the same fast lifecycle works in your favor. Remove their breeding sites, trap the adults, and keep things dry, and the population collapses within one to two generations. For most people, that means the problem is fully resolved in two to three weeks.