Nematodes are important: parasitic nematodes threaten the health of plants, animals and humans on a global scale; interstitial nematodes pervade sediment and soil ecosystems in overwhelming numbers; and Caenorhabditis elegans is a favourite experimental model system. A lack of clearly homologous characters and the absence of an informative fossil record have prevented us from deriving a consistent evolutionary framework for the phylum. Here we present a phylogenetic analysis, using 53 small subunit ribosomal DNA sequences from a wide range of nematodes. With this analysis, we can compare animal-parasitic, plant-parasitic and free-living taxa using a common measurement. Our results indicate that convergent morphological evolution may be extensive and that present higher-level classification of the Nematoda will need revision. We identify five major clades within the phylum, all of which include parasitic species. We suggest that animal parasitism arose independently at least four times, and plant parasitism three times. We clarify the relationship of C. elegans to major parasitic groups; this will allow more effective exploitation of our genetic and biological knowledge of this model species.