Abstract The bacterial diversity associated with soil nematodes and its relationship with their feeding habits are as yet poorly understood. In the present study the diversity and abundance of bacteria from nematodes and their surrounding soil were analysed and compared. The nematodes were collected from a grassland soil and sorted into bacterial, fungal, plant, predatory and omnivore feeding groups and assigned to taxonomic groups. Total DNA was extracted from the nematodes and partial bacterial 16S rRNA genes were PCR amplified, cloned and sequenced. The abundance and composition of bacterial taxa differed between and within feeding groups. The lowest bacterial diversity was found in the predatory nematodes Prionchulus sp., whereas the highest bacterial diversity was associated with the bacterial-feeding nematode Acrobeles sp. The soil had a more diverse bacterial community than the communities found in the nematode groups. The 16S rRNA gene sequences of bacteria associated with nematodes did not overlap with those detected in soil as determined using the cloning screening approach. However, bacterial sequences identified from nematodes could be detected in the soil with targeted PCR. Our data suggest that the nematodes do not feed on the most abundant bacteria present in soil. Furthermore, several nematodes contained suspected bacterial symbionts and parasites.