Pill bugs and sow bugs are small crustaceans (not insects) that live on decaying organic refuse. If you turn over the top layer of your compost pile and see thousands of tiny gray, creatures that look like armadillos with seven pairs of legs each, you have discovered a nest of these bugs. (Pill bugs roll up into a ball when threatened and sow bugs don't; other than that, there isn't much difference between them.)
Sow bugs won't harm your compost—in fact, they're actually helping to break it down. But if you don't remove them from the finished mixture before you spread it on the garden, you might find them snipping off the emerging roots and leaves of your beans, beets, and other seedlings.
(Like what you're reading? Sign up for our newsletter to get health insights, clever kitchen tricks, gardening secrets, and more—delivered straight to your inbox.)
Ants and earwigs also invade compost piles. Like sow bugs and pill bugs, they are essentially harmless to the composting process, but their presence may indicate that your pile is on a slow track to decomposition.
To get these bugs out of your compost, raise the heap's temperature to above 120°F. (If you aren't sure what your pile's temperature is, measure it with a compost thermometer or a regular old meat thermometer wrapped in plastic.) Turn the pile over and rebuild it, watering it well as you go. If it contains lots of leaves or straw, mix in a nitrogen source like bloodmeal, manure, or shellfish shells. It should start heating soon, and when it does, those bugs will depart for a more comfortable place. To keep your pile cooking, turn it at least every 2 weeks; more often if possible.
But what if your finished compost is infested with sow or pill bugs and you want to use it where seedlings are growing? Do you have to start all over again? No. Spread the compost in a thin layer on a tarp in direct sunlight and leave it there to dry. The bugs will bail out quickly.
Related: The Many Amazing Ways Earthworms Can Help Your Garden