How To Get Rid Of Fruit Flies In Compost


Are annoying fruit flies ruining your composting routine?

Eliminate problems with those tiny pests by following the tips in this guide on how to get rid of fruit flies in compost.

Inside, you’ll learn why fruit flies are congregating around your indoor and outdoor compost bin and how to stop them by using traps, sprays, and diatomaceous earth so you can happily compost bug-free!

Why Fruit Flies Are In Your Compost

To stop fruit flies from hanging around your composter, you need to know what is attracting them there in the first place. 

Be aware that what many people assume are fruit flies can actually be:

  • Sandflies (aka no-see-ums)
  • Biting midges or gnats
  • Vinegar flies (a sub-species of fruit fly)

If any of the little critters around your compost are biting you, then you know they are not fruit flies. Fruit flies do not bite and are most recognizable by their red eyes.

Let’s take a look at what conditions in indoor and outdoor composting systems fruit and these other types of flies find irresistible.

Indoor Compost Bin

There’s a joke in my family that after we eat the last banana, it’s time to go shopping because we are “Out of fruit flies.”

This joke rings true since most of the time, the fruit flies that appear indoors hitch a ride to your house on the fresh produce you purchase from a store or farmer’s market.

Fruit fly eggs or larvae are so minuscule and often hide under the skin of fruits and veggies that you’ll have a hard time removing them all, even with a thorough washing. 

Another point of entry into your home is open windows or doors, where flies can gain access as they follow the scent of rotting food in your kitchen compost bin. Keep doors and windows shut when possible to deter flies from entering your home.

Once inside your home, the fruit flies are looking for an easy meal, and your indoor compost bin offers decomposing fruit scraps and the yeast that forms, which these types of flies love. Keeping a layer of brown compost material on top of food scraps will help prevent flies from smelling the rotting food and sticking around.

If larger house flies hang around your compost bin, chances are they are there to feed on any meat scraps or bones you may put inside your bin. Unless you have a Bokashi compost system, never put meats or bones in your compost.

Outdoor Compost Bin

You’ll find flies around or inside your outdoor compost bin because there are thousands of flies in the surrounding neighborhood just looking for an easy meal. Your compost bin will attract them if they smell the scents of rotting food. 

You’ll also have the offspring of any eggs that were hiding in the skin of any fruit or vegetable scraps you add into your compost bin hanging around to eat any rotting fruit.

If large amounts of fruit flies are hanging around your outdoor composter, then chances are you aren’t covering the top with a suitable barrier layer of brown material, or you are not turning the compost enough.

Stopping Fruit Flies

fruit fly stuck yellow sticky paper

Occasionally ingesting fly larvae or eggs shouldn’t be a health concern for most humans, but it can’t hurt to remove the skin from fruits and vegetables before consumption. 

When you toss these scraps into your compost bin, you are delivering fruit fly babies into an environment that helps them grow and mature.

To combat fruit fly infestations, I break down three conventional methods to control these pests in and around your compost bin.

Fruit Fly Traps

Fruit fly traps are a top choice for the removal of large amounts of bothersome flies.


  • Pesticide-free option
  • Fairly effective
  • Inexpensive
  • Easy to make (or purchase)


  • May take several days to see results
  • Can look unsightly

You can purchase indoor and outdoor fruit fly traps online or at a grocery or home improvement store.

TERRO Fruit Fly Trap

TERRO T2502 Ready-to-Use Indoor Fruit Fly Trap with Built in Window - 2 Traps + 90 day Lure Supply

Unique Features

  • Lasts up to 45 days
  • Ready to use
  • Attracts adult fruit flies

Garsum Yellow Sticky Traps

Garsum Yellow Sticky Fruit Fly Traps 48 Pcs Gnat Trap for Indoor/Outdoor Houseplant Sticky Bug Insect Catcher Glue Trappers

Unique Features

  • Indoor and Outdoor use
  • Odorless
  • Waterproof and UV resistant

If fruit flies are a common occurrence in your compost bin, buying pre-made fruit fly traps can become expensive. Luckily, there are home-made traps you can quickly put together that are just as effective.

I find that this recipe helps catch and kill the fruit flies that gather at both my indoor and outdoor compost bins.

The vinegar scent attracts the fruit flies, and when they try to “land” on the surface of the liquid to feed, the dish soap breaks the surface tension, and the flies sink into the vinegar and drown. 

Many people opt to use kombucha tea instead of vinegar. I have tried this and find it attracts the fruit flies quicker than the vinegar, probably because of kombucha’s natural ingredients.

TIP – Set a funnel on the top of the jar. Fruit flies will work their way down through the hole but are unable to fly straight back up, so the chances they fall into the liquid and die are much higher than with an open-top jar.

fruit fly vinegar trap

If you don’t have a funnel, use plastic wrap over the top and poke a few small holes on top so the flies can crawl inside.

Keep the jar out until the fruit fly issue is gone. Replace the liquid every four or five days. If you place the jar outdoors, set it as close to your compost bin as possible, but out of the elements since rainfall will ruin the trap.

Fruit Fly Sprays

For more instant results, there are fruit fly sprays on the market you can use to contain infestations.


  • Quick and easy to use
  • Works both indoors and outdoors
  • Works instantly
  • Works on other small insects as well


  • May contain harmful chemicals
  • Mist lands on other surfaces in your home

Sprays are great to have on hand when fruit flies rear their ugly heads, and you want to get rid of them fast.

Sprays tend only to kill active mature adult flies, so expect the need to spray for several days in a row to eradicate the hidden larvae as they hatch.

Diatomaceous Earth And Fruit Flies

Diatomaceous earth is probably my favorite method of keeping fruit fly issues at bay in my compost bin. 


  • Pesticide-free
  • Will not harm my compost
  • Very effective
  • Inexpensive
  • Easy to use and store


  • Takes several applications for control

Diatomaceous earth (DE) sprinkled over the top of your compost’s brown layer works because the granules are very sharp and cut up the exoskeleton of insects that try to pass through. The insect then dies quite quickly thereafter, preventing them from reproducing.

During the summer, when my family tends to eat more fruit that ends up in the composter, I use diatomaceous earth almost as a preventative measure against fruit fly invasions. 

After I turn my compost bin, I layer on some leaves or shredded cardboard and generously sprinkle diatomaceous earth on top. You can even follow this process in vermicomposting systems since DE is not harmful to worms.

In Summary

When you take the time to keep your compost bin in balance, and you still have an issue with fruit flies, the tips in this guide help show you how to get rid of fruit flies in compost effectively.

From sprays, traps, diatomaceous earth, as well as careful handling of food scrap waste in your outdoor or indoor compost bin, you don’t have to live with troublesome fruit flies ever again!

Share This Article