Troubleshooting

Getting Rid of Fruit Flies Around Compost

How to get rid of fruit flies around a compost bin or kitchen pail by burying food, covering scraps with browns, emptying often and trapping adults.

On this page
  1. Why fruit flies show up
  2. Fix the bin first
  3. Fix the kitchen pail
  4. Trap the adults
  5. Be patient

Why fruit flies show up

Fruit flies are drawn to fermenting fruit and vegetable scraps. They lay their eggs in exposed food, and the larvae develop in it. That means the flies keep coming back until the food is covered or removed. Scraps sitting in a kitchen pail can attract them just as a bin can.

Fix the bin first

  • Bury new scraps. Dig them into the middle of the pile rather than leaving them on the surface.
  • Keep a thick layer of browns on top. Leaves, straw, or shredded cardboard work well. One Massachusetts state fact sheet suggests keeping roughly 12 inches of high-carbon material on the surface of the pile, with food scraps buried beneath it.
  • Close the lid. A tight lid, or a tarp over the top of an open bin, limits access.
  • Turn the pile. Turning buries any food that has ended up on the surface.

Fix the kitchen pail

  • Empty it often. A South Carolina county tip sheet suggests holding only a day or two’s worth of scraps indoors.
  • Freeze scraps between trips. Freezing stops fruit fly eggs from developing, so it is a useful way to hold scraps until a drop-off or bin visit.
  • Keep it covered. A tight lid on the kitchen pail keeps the flies out.
  • Use compostable bags. A bag keeps the pail cleaner and makes it easier to empty.
  • Rinse the pail. Residue left on the sides keeps attracting flies.

Trap the adults

Traps catch the flies that are already there:

  • Vinegar trap. Put a splash of apple cider vinegar and a drop of dish soap in a small cup or jar.
  • Banana trap. Put a banana peel in a jar, cover the top with plastic wrap, and cut a small slit in it. The flies can get in but have trouble getting out.

Be patient

Fruit flies breed quickly, so clearing them can take a few weeks. Vacuuming removes the adults you can see, but not the eggs and larvae in the food, so it will not solve the problem on its own. Cutting off the food supply is what breaks the cycle.

The complete guide to troubleshooting

Fixing Common Compost Problems
Read the guide

Keep exploring

Guides from other topics

All topics →