Just what do worms eat anyway? If you answered dirt, you be right, in a sense. If you answered anything they could get in their mouths, you'd also be right. Some of us ate dirt once, when we were toddlers. Not so much for the dirt's nutritional value, which is why the worm eats dirt, but to upset our parents. We never really ate all that much, and most of us came out none the worst for wear. Some people eat anything they can put into their mouths, just as the earthworm does, and like an earthworm, which can get big and fat, so do those people.
To understand why a worm can eat what it eats, its helpful to look at its digestive system, which is not too different from ours, but somewhat simpler, plus being longer and straighter. Two things an earthworm has in its digestive system that we don't, though some birds, such as chickens do, are a crop and a gizzard. Since a worm actually sucks food into its mouth, it has not teeth to grip with, it’s going to get dirt along with whatever else it’s trying to eat. Dirt consists in part of very small stones, and as such serves a useful purpose. In the worm's gizzard, the stones are used to grind up and crush microscopic bits of food, so the worm can digest them. Most of the actual food a worm ingests is too small for us to see with the naked eye. The worm's mouth isn't all that much larger. The stones (or dirt) don't remain in the gizzard permanently. They will be replaced by more stones and dirt, and will eventually be passed though the worm. What is solid waste to the worm is beneficial to us. Worm waste, called worm casings, contain many nutrients used by plants. Garden soil containing many worms is almost always very fertile soil. Over time, most soil in a garden is apt to be made up of worm casings.
Bacteria, Fungi, And Other Stuff - Getting back to the question of what do worms eat anyway? Worms that live quite a bit under the surface do in fact eat mostly dirt, but the dirt contains fungi, algae, bacteria, or any other organism that happens to be living there as well. These organisms contain the nutrients the worm needs, and a worm that eats nothing but raw dirt can still be a happy worm. Worms living nearer the surface however usually have a wider variety of foods available, a literal smorgasbord in some cases. Worms are especially fond of organic matter, ranging from dead grass or decaying leaves. The worms aren't vegetarians in the strictest sense, as they digest or use only fungi or bacteria that are growing on the leaves. The bulk of a leaf, like dirt, is passed on through.
Protect Your Worms - The same is true of compost in general, and also of coffee grounds, which we all know can attract hordes of worms, though probably not for the caffeine, but again for bacteria and fungi. No matter what worms may eat, what they leave behind almost always benefits plant life, and it's good practice to be a little protective of the worms that may inhabit our flower or vegetable garden. There are admittedly some types of worms we could best do without, but the earthworm certainly doesn't fit into that category. We should probably shed a tear any time we accidentally cut a worm in half when digging in the garden, but that can't always be helped. One doesn't end up with two worms, as some may believe, but half a worm, depending upon where it was bisected, may live on.