An earthworm is a soil-dwelling terrestrial invertebrate that belongs to the phylum Annelida. The term is the common name for the largest members of the class (or subclass, depending on the author) Oligochaeta. In classical systems, they were in the order of Opisthopora since the male pores opened posterior to the female pores, although the internal male segments are anterior to the female. Theoretical cladistic studies have placed them in the suborder Lumbricina of the order Haplotaxida, but this may change. Other slang names for earthworms include "dew-worm", "rainworm", "nightcrawler", and "angleworm" (from its use as angling hookbait). Larger terrestrial earthworms are also called megadriles (which translates to "big worms") as opposed to the microdriles ("small worms") in the semiaquatic families Tubificidae, Lumbricidae and Enchytraeidae. The megadriles are characterized by a distinct clitellum (more extensive than that of microdriles) and a vascular system with true capillaries.
Earthworms are commonly found in moist, compost-rich soil, eating a wide variety of organic matters, which include detritus, living protozoa, rotifers, nematodes, bacteria, fungi and other microorganisms. An earthworm's digestive system runs the length of its body. They are one of nature's most important detritivores and coprophages, and also serve as food for many low-level consumers within the ecosystems.