17 Ways to Get Rid of Bugs in Your Compost Bin

If you love composting, you very likely get frustrated with bugs and pests that get into the compost bin. Getting rid of the bugs isn’t difficult if you know what to do, but you have to first realize that not all bugs are bad for your compost.

To get rid of bugs in your compost bin, you have several options, including using a wire mesh, caring well for your compost pile, and even adding a layer of shredded paper, sawdust, or soil to the pile.

Below is some information on the bugs you might find in your compost bin and what you can do to get rid of them.

Flies, Flies Everywhere

Flies are very often found around compost piles because the foods within the compost are the ones they love to eat. Seeing flies around a compost is more common than finding any other pests.

Some of these flies include fruit flies, vinegar flies (AKA “small” fruit flies), and gnats. To get rid of them, you can follow these steps:

  1. If you are composting rotten fruit, make sure it gets buried deep inside of the compost pile.
  2. Place wire mesh around the pile to ventilate it and prevent the flies from getting in.
  3. Always close the lid of your compost bin very tightly.
  4. Maintain your compost pile regularly so it is as “clean” as possible.
  5. Cover any material that seems to be attracting flies or gnats, such as rotten fruit.
  6. Place a layer of dead leaves on top of the rotten fruit.
  7. Place a layer of shredded paper on top of the rotten fruit.
  8. Check to see if your soil is alkaline; if it is, place a layer of pine straw on top of the rotten fruit, which will acidify the compost pile.

Maggots and Grubs

Maggots and grubs are bugs that are actually good for your compost pile. That being said, keep in mind that there are many different types of maggots, and you’ll often find them in your compost pile when that pile loses its balance.

Maggots are more commonplace when you have more greens than browns, but grubs will stay away.

The black soldier fly is the most common type of maggot, but there are also rhinoceros grubs, which are not harmful to the compost and can actually help decompose your organic matter.

If you’d prefer to get rid of maggots and grubs because you don’t like the way they look, you can:

  1. Cover the pile with a wire mesh so the flies cannot lay eggs.
  2. Add more browns to the pile, such as sawdust or dead leaves, because greens attract maggots.
  3. If the maggots are there and thriving, try adding lime to the compost pile.

Finally, if you only have a few maggots, it’s best just to leave them alone. Only when they appear in large quantities should you even consider getting rid of them.

Isopods and Pillbugs

Pillbugs are often called rolly pollies because they roll themselves into a tight ball when someone or something disturbs them. Pillbugs are actually good for compost piles and are in fact commonplace when you have a compost bin.

The good news is that rolly pollies will not bite humans, are completely harmless to plants, and do a great job of breaking down the organic matter in your compost pile. As long as you turn your compost pile frequently, these tiny little bugs will actually benefit it.


Mites are certainly annoying in many circumstances, but most mites are actually good for your compost pile. The one possible exception is the earthworm mite, which can usually be found on decaying fruit.

They are reddish-brown in color and are responsible for depriving earthworms of their primary food source. Tiny red mites are also common, and they too like to feed on earthworms. If you have earthworms or red mites, here are a few things you can do to eliminate them:

  1. Make sure the compost pile is exposed to several hours of sun every day.
  2. Make sure the compost remains moist at all times.
  3. Add some food-grade diatomaceous earth to your compost bin, which will get rid of the mites but leave the earthworms alone.
  4. To kill the mites, try scorching the top layer of your compost pile.
  5. Place a layer of sweet fruits on the compost pile, then dispose of the fruits once the mites start to gather on them.


If you’re unfamiliar with springtails, they are very small insects that are unable to fly, but they jump if something disturbs them. They feed on the carcasses and excrement of insects and tend to gather in large numbers around a compost pile.

They are another type of bug that is harmless to your compost pile and to most of your plants, but you can still get rid of them by doing the following:

  1. Make sure your compost soil is nice and damp at all times.

Another helpful tip when trying to get rid of bugs in your compost pile is to make sure you turn your pile weekly and do it correctly. To do this, simply flip the compost pile inside out once a week, and use a shovel to make sure the outer section of the compost pile gets closer to the center.

It’s a simple step that takes very little time, but you’ll be surprised by how helpful it is in producing a healthy compost pile year after year.


The bottom line if you have a compost pile is this: most of the bugs you’ll run into will be harmless and may even benefit the compost. For the few bugs that can harm your compost pile, you now have a few ways to get rid of them effectively and naturally.

Happy growing.