My worm composting bin is infested with fruit flies. What can be done to get rid of the flies?

6 Answers 6


Generally this comes from having an excess of "greens" rather than "browns" in the bin, and potentially too much moisture also.

When this has happened to me I generally put a generous amount of shredded newspaper / junk mail in, and try to let it dry out as much as possible - the fruit flies will then tend to up and leave.

It's probably also worth noting that the flies aren't an inherent problem to the compost per-se, they're just rather unpleasant.

  • I agree that with the way I phrased the question, it is a good idea to point out that fruit flies are purely an annoyance. +1! I'll try your suggestion and will accept if it helped!
    – DudeOnRock
    Commented Feb 22, 2013 at 1:56
  • "the flies aren't an inherent problem" - yes, the fly maggots help break down the food, too!
    – Jay Bazuzi
    Commented Mar 10, 2013 at 3:51
  • @JayBazuzi They also fall into beverages that we drink and generally pester us in our home. I prefer that the wingless worms do the job of breaking up the food. Commented Nov 19, 2019 at 14:25
  • I have found spent BBQ coals work even better as a source of carbon. They are claimed to even add much needed potassium unless dozed with excessive amounts of water.
    – Vorac
    Commented May 25, 2022 at 7:50

You can make a trap to catch the existing fruit flies with an empty jar, a small plastic sandwich or zip close baggie with square corners, a rubber band and some wine or beer.

Pour a small amount of beer in the bottom of the jar. Snip off a tiny bit of the corner of the bag, making a small hole. Push the corner of the bag a few inches down into jar, making a funnel shape, and pull the rest of the bag over edge of the jar. Put a rubber band around the the rim of the jar sealing the edge of the bag.

The fruit flies crawl in through the funnel, then can't get back out. I seen similar versions of a fruit fly trap where you punch small holes through the lid of the jar with a nail.

  • 1
    My version of this trap is easier to make: roll a piece of paper to make a cone with a very small hole at the tip. Find a tall narrow glass and, holding the cone so it doesn't unroll, put it in the glass. The tip should not touch the bottom. Narrow or widen the cone until it will fit. Staple or tape so the cone stays that size. Put fruit juice, wine, or a piece of fruit and some water in the glass, then drop in the cone. Regularly take the apparatus outside, remove the cone to release the flies, then put the cone back and replace the trap. Commented May 20, 2014 at 16:14

I will make this brief: Search for fruit fly lifespan. An associated article shows an experiment of the effects of sweeteners on fruit flies done by a 6th grader. He found that Truvia killed fruit flies. So I tried Truvia in my worm bin and it works! AND the worms are not harmed. You should try it and if it works for you, spread the word: No more fruit flies in worm bins. Steven Goddard

  • 1
    Could you provide the references you refer to? Why Truvia and not just plain old stevia or any other of the ingredients of Truvia?
    – Earthliŋ
    Commented Nov 24, 2015 at 17:34
  • 1
    The study can be found here, but a more accessible news article about it can be found here. Since Truvia works as an insecticide, I am wondering if it is really safe for the worms. It seems there has been no research on the effects on other insects.
    – THelper
    Commented Nov 24, 2015 at 21:40

The combination of 4 things worked for me:

  • stop over-feeding and let the compost dry if too wet
  • vacuum the flies daily
  • cover all the food scraps and put a layer of dry newspaper shred on top of the compost
  • have a trap near the compost to catch some of the flies (yellow container with water + dish soap + sugar works for me, as yellow color and sugar attract flies and dish soap makes them drown)

This method instantly improves your compost situation, but it may take weeks to get rid of all the flies, as your compost probably has some eggs.

  • We have so many that they even filled up bottoms of wine bottles that we placed next to the bin, planning to take them to the glass bin. We kept them there as traps. Commented Nov 19, 2019 at 14:26

You could use some food grade DE on your compost pile this will help dry it out and will most certainly kill all the fruit flies.


As others already said:

  • add more dry stuff to reduce the moisture (cardboard pieces),
  • open it daily to make the adults fly away,
  • use a vinegar bait and cover well all the food with dry material (cardboard pieces).

In addition:

  • kill the pupae (cocoon) that you see on the back cover or box walls, they are the fly cocoons which looks for dryer part of the compost to become adults.
  • stop putting in fruit remains. Put only non-sweet waste (vegetable)

In practice: my personal experience is that if you keep in putting fruit waste, fly larvae will keep managing to grow and you won't manage to get rid of them entirely.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.