How To Eliminate Maggots in Compost Bins

Regan Hennessy

In addition to the millions of microscopic bacteria that decompose the organic waste in a compost bin, a variety of larger creatures helps produce the finished product, including soldier flies.

Although beneficial to the composting process, soldier flies can lay eggs in the compost, producing maggots--also called larvae--which have the singular ability to disgust even the most enthusiastic composters. Grayish-white in appearance, soldier fly maggots are approximately an inch long and wriggle actively, especially when exposed to light. Since these maggots thrive on nitrogen-rich materials, one of the keys to eliminating them from your compost is maintaining a proper balance of carbon materials in the bin.


Sawdust is a high-carbon material that works particularly well at soaking up excess moisture in a compost bin. Add it or any other high-carbon material in small clumps so that they don't cause the organic materials to get too dense. Monitor carefully the amount of high-nitrogen materials added to the compost bin. Maggots consume high-nitrogen material, including animal waste, vegetable peels and spoiled fruit. By limiting the amount of high-nitrogen materials in the compost pile, the maggots’ food source is reduced.


Adult soldier flies seek out exposed nitrogen-rich materials to lay their eggs so their young can have food to consume.

Wear gloves if you are transporting maggots from the compost bin to another location.

  1. Check the moisture level of the compost bin. The aim for compost bin is for it to be the consistency of a wrung-out sponge. If the compost is dripping wet it’s too moist.

  2. Add carbon-rich materials such as shredded newspaper, cardboard, dead leaves, straw or old hay, to the compost bin to reduce the moisture level and to offset the amount of nitrogen materials.

  3. Cover the nitrogen materials in your compost with at least 2 to 4 inches of carbon materials. Bury food scraps and other nitrogen-rich materials thoroughly in the bin.

  4. Feed maggots in the compost bin to the birds to help control them. Dump the larvae in a location that is away from buildings so birds can easily find them.