8 Ways to Get Rid of Fruit Flies in Compost

fruit flies in compost
One of the best ways to permanently eliminate fruit flies is by avoiding providing them with the food they like so much – rotting fruits and veggies, beer, wine, dried fruits, sugar molds, and more.

Are you worried about the annoying little pets in your compost? Well, you’re not alone. Fruit flies are a common problem for composters.

These tiny flies are the larvae of the vinegar flies (Drosophilidae family), which is why they are so attracted to things like banana peels, oranges, and apple skins that tend to accumulate in composting bins.

Once you get them started, it becomes a vicious cycle. The fruit flies lay their eggs on the decomposing kitchen waste, and when those eggs hatch, you end up with even more adult flies ready to lay more eggs on your compost pile. 

What’s worse is that they can quickly spread from your kitchen into other rooms of your home, where they can feast on other sources of rotting fruits and vegetables. 

So, how do you get rid of fruit flies in your compost?

To help you deal with fruit fly infestations, we’ve put together some of the important details you need to know and tips to help you squash the tiny flies in your compost. Read on to find out more.  

Why Are There So Many Fruit Flies in Compost?

Although fruit flies are only a nuisance in compost bins, they’re a sign of too much rotting organic matter. 

If your compost bin is heavily populated with rotting organic matter, expect it to attract these tiny visitors. Fruit flies are usually attracted to the sweet smell of decaying fruits and vegetables in your compost heap.

Another reason flies might infest your compost pile is the moist and warm environment in your bin, which provides favorable conditions for laying eggs.

Is It Normal to Have Fruit Flies in Compost?

Yes, it’s normal to have fruit flies in your compost. It’s also possible for the fruit flies to be present even when there are no issues with your compost pile.

Fruit flies are a common problem in the summertime when warm temperatures and high humidity cause them to breed quickly.

Are Fruit Flies in Your Compost Good or Bad?

Generally, no one wants these annoying flies buzzing around their ears, but the truth is that they’re harmless and good for your compost. This is because their poop can add nutrients while their maggots feed on organic matter, speeding up decomposition.

However, studies have shown that these tiny critters can be a hazard for humans because of the spread of disease-causing pathogens. 

How To Get Rid of Fruit Flies in Your Compost Bin

Did you know several DIY solutions only call for standard home goods that can make getting rid of fruit flies in your compost pile hassle-free?

Well, here are some of the methods you should try:

1. Get rid of the food Source 

Getting rid of the food source? Yes, you read that right. There are reasons why this tops our list as one of the preferable ways to get rid of fruit fly infestation.

Obviously, these tiny clitters need a source of food to survive; therefore, starving them means permanently eliminating the problem.

All you need to do is remove any food source—kitchen waste, especially fruits and vegetable peelings—from your kitchen counters and compost bins.

2. Use a Vinegar Trap for Adult flies

To efficiently eliminate or stop fruit flies from infesting your compost heap, kill the adult flies in the first place to prevent them from breeding readily.

One of the best ways of eliminating adult flies is using a vinegar trap because they can’t resist its smell.

Here is what you’ll need to make this trap:

  • Apple cider vinegar
  • A glass jar
  • Warm water 
  • Dishwashing soap (preferably citrus scented)
  • Plastic wrap 

Pour about 1 cup of apple cider vinegar into a glass jar with warm water. Add a few drops of dish soap to the mixture to remove surface tension so the flies can drown inside it.

Cover the glass jar using plastic wrap, and poke a couple of holes in it using a needle or toothpick. Then place the glass jar near the fruit flies and watch them flock into it.

Extra Tip: Because vinegar loses potency over time, you should replace it at least after a day or two.

3. Make a Fruit Fly Trap 

Don’t have vinegar? Worry not. There are other ways to use homemade fruit fly traps to eliminate the little buggers in your kitchen compost bin.

These include:

  •  Rotten fruit trap: Place some finely chopped rotting fruits in a bowl and cover them tightly using plastic wrap.  Make a few holes (which should be large enough to enable the fruit flies to crawl through but not escape) on the wrap using a toothpick. 
  • Wine bottle trap: The little critters love the smell of wine because it shares the same characteristics as fermenting fruits. Place a bottle with a few drops of wine close to the fruit flies to catch them.
  • Beer trap: Like vinegar and wine, beer acts as a fruit fly attractant. Put roughly a half-cup of beer in a mason jar, make a few holes on the lid and place it near fruit flies. The buggers will gulp down the booze, and before you know it, they’ll be drowning.
  • Banana peel trap: Taking advantage of the fact that fruit flies love bananas is yet another way to use your kitchen waste properly. Put the banana peels in a plastic container and cover them with plastic wrap, poking holes in the wrap as you go (large enough for the flies to zero in).

4. Freeze Kitchen Waste

The groceries you purchase at your local food store may be already infested with fruit fly eggs and larvae.

For this reason, store food scraps you intend to compost in the freezer. The cold temperatures will eliminate the fruit fly eggs.

You can store the scraps using a plastic bag or buy a freezer compost bin.

5. Consider Hot Compost

You’re probably aware of how essential hot compost is to accelerating decomposition. Well, it also comes in handy when dealing with fruit fly problems.

Research by Cambridge University suggests that temperatures above 45 °C kill any fruit fly eggs and larvae (maggots).

Therefore, if you keep your compost bin temperatures operating between 45-60 °C, be sure that the little visitors will not survive inside your pile.

6. Add Brown Material to Your Compost 

Typically, there should be a balance between green and brown particles in good compost. However, in this instance, the greens (fruit and vegetable waste) in your compost pile are what the fruit flies are attracted to. 

To make your compost pile less alluring for the fruit flies, you might choose to add more brown materials like shredded paper, sawdust, leaves, and hay.

7. Seal Your Compost Bin

Sealing your compost bin every time you add food scraps is another easy yet efficient approach to dealing with fruit fly infestation.

This will not only assist you in getting rid of the undesirable company, but it will also keep off odors.

Remember that the organic material in your compost heap needs oxygen to decompose. Therefore, you need to seal your composter to permit air to flow inside the bin.

8. Wrap Scraps Up

Before throwing any food scraps into your compost bin, wrap them in old newspapers to keep flies away.

The newspapers will eventually decompose and add value to your compost because they’re a component of the brown material in your compost. This technique aids in controlling the rotting-material odor that draws fruit flies.


Discovering composting as a way of life or even better, as nature’s way of recycling, Ana dedicates her time to trying out new methods of composting at home. Her goal is to share everything that she’s learned in the hopes that it will help others discover the amazing rewards of composting.

Recent Posts