Troubleshooting

How to Get Rid of Fruit Flies in a Worm Bin

A five-step plan to clear fruit flies from a worm bin and keep them out for good, plus how to tell them apart from fungus gnats, which need a different fix.

Macro image of a fruit fly (Drosophila melanogaster) on wooden surface.
In this guide

A cloud of fruit flies when you lift the lid is one of the most common worm bin complaints, especially in summer. They don’t hurt the worms, but they’re a nuisance indoors. The good news is that they’re almost always a sign of a few fixable habits.

First, identify the fly

Two different insects show up in worm bins, and they need slightly different fixes.

Fruit flies

  • Tan or light brown body
  • Bright red eyes
  • Hover around food and fly fairly well
  • Attracted to fermenting fruit
  • Lay eggs on the surface of ripe fruit and peels

Fungus gnats

  • Dark grey to black, slender, mosquito-like
  • Dark eyes, long legs
  • Weak, erratic fliers that stay close to the bedding
  • Attracted to damp, organic material
  • Larvae live in moist bedding and feed on fungi

If you see red eyes, it’s fruit flies. If they’re dark and lazy, it’s probably fungus gnats. Many bins have both.

Five steps to clear fruit flies from a worm bin, and fruit flies vs fungus gnats
Fruit flies have red eyes and hover near food. Fungus gnats are dark and stay near damp bedding.

Where they come from

Fruit flies usually arrive as eggs on fruit you bought. Banana peels, mango skins and stone fruit are the usual carriers. When you add the peels to the bin, the eggs hatch in a warm, food-filled paradise.

Fungus gnats arrive from houseplants, potting soil or outside, and breed in wet bedding.

A cozy still life with homemade apple cider in a glass jar surrounded by pumpkins on a wooden table.
Photo by olia danilevich on Pexels
Related guideHow to Fix a Wet, Soggy Worm Bin

The five-step plan to clear fruit flies

1. Bury every feeding

Exposed food is a fly nursery. Bury all food under at least 2 inches (5 cm) of bedding. If flies are already present, go deeper, to 3–4 inches.

2. Freeze scraps before feeding

Freezing for 24–48 hours kills fruit fly eggs and larvae. Keep a scrap container in the freezer and thaw it before feeding. It’s the single most effective long-term fix. Our guide to freezing and pre-composting scraps explains the method.

3. Cover the surface

Lay a sheet of damp newspaper, cardboard or burlap directly on top of the bedding. Flies can’t reach the food to lay eggs, and the cover keeps moisture even. Replace it when it breaks down.

A layer of dry shredded cardboard or coir on the surface also works.

4. Trap the adults

Adults will keep laying eggs until you remove them. Simple traps work well:

  • Vinegar trap: a jar with a little apple cider vinegar and one drop of dish soap. The soap breaks surface tension so flies sink.
  • Paper cone trap: a jar with a piece of overripe fruit and a paper funnel in the top.
  • Yellow sticky traps: good for fungus gnats, placed just above the bedding.

Place traps next to the bin or inside the lid. Empty and refresh every few days.

5. Fix the moisture

Fungus gnats in particular breed in overly wet bedding. Do a squeeze test (see our moisture guide) and mix in dry cardboard if the bin drips.

Extra tactics for a bad outbreak

Stop feeding for a week

No new food means no new breeding sites. Worms will happily eat bedding meanwhile.

Vacuum the adults

A handheld vacuum quickly removes a cloud of flies when you open the lid. Empty it outside.

Add mesh to the air holes

Fine mesh or old tights glued over air holes keeps new flies out while letting air in.

Remove the worst food

Dig out any obvious mushy fruit masses crawling with larvae.

What not to do

  • Don’t use insecticide sprays. They can kill your worms.
  • Don’t seal the bin airtight. Worms need oxygen.
  • Don’t panic. A few flies are normal in a bin full of fruit scraps. You’re aiming for control, not a sterile bin.

How long until they’re gone?

Fruit flies complete a life cycle in about a week or two in warm conditions. Following the plan consistently usually brings numbers right down within two to three weeks, as adults die off and no new generation develops.

Keeping them away

  • Freeze or bury all fruit scraps, always
  • Keep a cover sheet on the bedding
  • Add dry carbon with every feeding
  • Avoid overfeeding. See how often to feed worms.
  • Keep a vinegar trap near the bin during summer

If you’re seeing other bugs, our guide to mites in a worm bin covers the other common bin visitors. And if the flies arrived with a sour smell, read our smell troubleshooting guide.

A two-week schedule to clear an outbreak

Day What to do
1 Set two vinegar traps. Vacuum adults. Lay a damp newspaper cover over the bedding. Start freezing all scraps.
2–3 Don’t feed. Check moisture and mix in dry cardboard if the bin drips.
4 Empty and reset traps. Remove any exposed, fly-covered food.
7 Feed a small amount of thawed frozen scraps, buried deep. Replace the cover sheet.
10 Reset traps. You should see far fewer adults.
14 Feed normally, still freezing and burying. Keep one trap out as an early warning.

Sticking to this for two weeks breaks the breeding cycle. Most bins are close to fly-free by the end.

Why some bins never get flies

Experienced worm keepers rarely see big outbreaks. Their habits are simple: every feeding is frozen first, buried deeply and covered with dry carbon, and the bin is never overfed. Flies need exposed, fermenting food to lay eggs on. Take that away and they have nowhere to breed.

Further reading: Oregon State University Extension’s Composting with Worms (EM 9034) covers fruit flies and other bin pests, and NC State Extension’s Worms Can Recycle Your Garbage has prevention tips.

Frequently asked questions

Do fruit flies harm worms?

No. They compete for food and are annoying, but they don’t attack worms.

Will soldier fly larvae appear too?

In outdoor bins in warm climates, you may see black soldier fly larvae: large, segmented, grey-brown grubs. They’re harmless to worms and eat food fast. If they take over, cut back on food and keep the lid closed.

Why do I still have flies after freezing scraps?

Adults already in the bin will keep breeding in any exposed food. Combine freezing with burying, a surface cover and traps until the existing population dies off.

Do fungus gnats hurt plants when I use castings?

Fungus gnat larvae can damage very young seedling roots in large numbers. Let castings dry slightly before mixing them into seed-starting mix, and top seed trays with a thin layer of sand, which gnats avoid laying eggs in.

Found this useful? Share it with a fellow gardener.

pasindukw

Wormbin Mastery is written by home composters who keep worm bins indoors and out. We test what we recommend in our own bins before it goes in a guide.

Ask a question or share your experience