Different earthworm species have different tolerances of acid soil conditions, and the application of lime to upland grassland to improve the grazing quality may therefore alter the size and diversity of the earthworm community. Altering soil properties may also affect the chemical characteristics of organic C in earthworm casts. We surveyed the earthworm community of an upland grassland in southern Scotland at the outset of annual lime applications, and after 3 years, and used C-13 nuclear magnetic resonance (NMR) spectroscopy to assess the distribution of C between different functional groups in the organic matter. In addition, soil was incubated for 8 weeks with several earthworm species in the presence or absence of lime, and the earthworm casts were subsequently analysed by C-13 NMR spectroscopy. Liming did not significantly affect earthworm abundance or species diversity, but it did affect the chemical composition of the casts. Casts from earthworms incubated in unlimed soil had greater ratios of alkyl-C to O-alkyl-C, indicative of more decomposed, recalcitrant C, and spectra from litter-feeding species had the greatest intensities of O-alkyl-C signals. In limed soil, the largest O-alkyl-C signal intensities were not restricted to litter-feeding species, indicating an increase in the quality of organic matter ingested by geophagous species.