By day, they lie in burrows with their heads near the surface. On warm, damp nights, earthworms stretch out in search of food, using their tails to anchor themselves for a quick escape into their burrows. Earthworm food includes leaves, seeds and grass clippings. The plant debris is pulled into the burrow where the soft parts are eaten with soil particles to grind the food. Another use for plant debris is to plug the burrow against moisture loss on hot days.
Earthworms literally eat their way through the earth.
Tunneling is accomplished by forcing themselves into small cracks, swallowing soil and debris that get in the way. Feeding is accomplished at the same time as tunneling. The maze of tunnels allows water and air to penetrate the soil. The other way earthworms improve soil is through their feeding. Soil and plant debris are bound together into crumbs as they pass out of earthworms, improving soil structure.