You reached into your compost container only to find a bunch of wriggly maggots. What do you do now? Is your compost ruined? Can you still use it? Not to worry. We’ll show you how to deal with maggots in your compost.
While some people think that a few grubs are no big deal, others say it’s a sign that something is wrong with your compost pile. When you have maggots in your compost, the end result is often a horrible smelling, slow-to-develop material. Good, healthy compost should smell earthy and fresh, and shouldn’t take forever to turn from waste to rich, black compost.
If you see the squiggly little worm-like creatures, they’re likely from the Black Soldier Fly (hermetia illucens). Like the adult fly, the maggots are attracted to and eat food waste. If you have them, it could indicate that you have too much green waste in your compost and not enough brown. So what can – and should – you do? Read on.

Are Maggots Good or Bad in Compost?

Opinions go both ways on whether maggots are good or bad. I know gardeners who have grubs in their compost heap and tolerate a certain level. Others have none and strive to keep them out. Those that allow maggots don’t often use a lot of the compost in their vegetable gardens but tend to use it more around ornamental trees as a mulch or garden filler.
One negative of having maggots is that they eat voraciously and most of the beneficial worms starve, so the wonderful worm byproducts will be missing from the final compost.
I have no maggots in my compost heap, and in my opinion, the presence of these larvae means the quality of the compost is questionable. It probably means something has gone wrong in what should be a strict and precise process.
If your compost quality isn’t top-notch, then you aren’t getting the ideal balance of nutrition, and you may introduce unwanted micro-organisms when you add your compost to the garden. Also, the site of those wiggling creatures in your compost is a little off-putting.
What Makes Good Compost?

What to Put In
Often when you end up with maggots in your compost, you’ve put the wrong things in. Compost heaps are a delicate balance of ingredients and layers. Things to add to your compost heap are:
- Vegetable and fruit peelings, and scraps
- Thin plant prunings
- Tea bags
- Grass cuttings
- Leaves
- Cardboard egg containers
- Eggshells
- Coffee grounds
- Manure from cows, horses, goats, and chickens
What Not to Put In
- Dairy or meat
- Dog or cat poo
- Diseased plants
- Noxious weeds
Why You Get Maggots and How to Get Rid of Them

Even if you put the right ingredients into your compost heap, if the amounts or levels are wrong, flies may find the environment enticing. An overly wet compost with lots of food for the flies will result in them laying their eggs, and you’ll end up with loads of squirming maggots.
The discovery of maggots in compost isn’t the end of your pile, and there are things you can do to get rid of them.
- Add more brown things – Adding layers of brown, well-dried things like leaves, straw, and egg cartons will dry the compost out and reduce the amount of food available to the fly. Make the top layer brown material to act as a barrier. Try newspaper or toilet rolls.
- Add lime – I add lime to most of my compost whether I have maggots or not. They don’t like it. Don’t add too much though or you may change the pH level excessively.
- Add pine needles – No lime? Use brown, dried pine needles. They take a little longer to break down, but maggots despise them. Pine needles are also acidic, so they’ll make your compost perfect for raspberries, strawberries, gardenias, and rhododendrons.
- Correctly layer your compost from the start – Start with a 6-inch layer of brown waste. Next, add a layer of a starter like manure, lime, or comfrey leaves. Finally, add a layer of food waste before repeating the process. Save the three types of layers separately until you get enough to add a full layer to the heap. When the pile is big enough, cover with old carpet to keep the heat in and flies out. You can also use a thick layer of hay or straw on top.
- Add citrus waste – If you’ve just juiced your citrus harvest and have loads of peels, get them in the compost to discourage maggots.
- Turn the compost regularly – Once you’ve layered everything correctly, start turning it with a pitchfork every 4-6 weeks or so. Flies lay their eggs in undisturbed, wet compost piles, so this will discourage them.
- Don’t overwater – Compost should be moist, not saturated. When compost is too wet, you create an anaerobic environment, which smells foul. That smell will attract flies.
Open Air or Closed Bin?
There are pros and cons to both open-air and closed compost bins. Both can end up with maggots. It’s all about following good practice.
Open Air

My main compost process is open-air because it doesn’t limit the size or number of bays I can have. I can get much more compost with an open-air design.
To succeed with the open-air style, you must layer your ingredients correctly and avoid overwatering. Utilize plenty of brown material and turn often.
I cover my piles with discarded carpet. If that’s not your thing, use cardboard or thick layers of newspaper. Covering allows you to control how wet the compost is. The sun dries it out, and rain makes it way too moist, but a covering will keep things even.
Closed Bin

I’ve used closed bin composts systems before and found it more likely to get maggots if the liquid can’t seep out at the bottom and the base becomes waterlogged.
You may think it’s good because the top of the compost looks dry, but below, it’s saturated. Over time this starts to smell bad, and the flies become attracted and lay eggs.
With a closed bin, you must ensure you layer properly, providing sufficient brown material. With the lid on, moisture builds up and sinks to the bottom, so be sure to rotate your pile often and don’t overwater.
Tips to Avoid Maggots
- Don’t pile on thick layers of cut grass. It’s tempting to empty the whole mower catcher in, but you have to layer brown in-between loads of cut grass. As grass breaks down, it becomes saturated and smelly.
- Don’t leave food scraps on top of the pile. Cover them with brown layers.
- Some people add a tablespoon of vinegar per 20 pounds of compost to deter flies and maggots.
- Place a homemade or store-bought fly trap near the compost bin to attract them away.
- Cover holes in compost bins with mesh.
What if You Still Find Maggots
If you’ve done everything to the best of your abilities, and you still find maggots, don’t panic. Maggots are an indication something isn’t quite right with your layering, moisture, or content. Just keep working at it.
Be proactive with your compost pile. It’s a living thing, and keeping it in good shape is so much more than just dumping waste and hoping for the best. A healthy compost pile shouldn’t smell and should be ready in about six months.
Smelly compost will more than likely attract flies and their little maggots, so avoid soaking wet piles sitting without adding layers of brown and turning regularly. Also, avoid only adding piles of food scraps and nothing else.
The Bottom Line
Maggots in your compost aren’t the end of the world. As long as your compost is developing nicely, you don’t have to worry too much. You can even use the compost once it’s ready, even if the little wigglers are still present.
That said, if you have maggots in your compost, your pile probably isn’t as healthy as it could be. Maggots are more of an indicator of a problem than an actual problem.