The density and spatial location of bacteria were investigated within different horizons of an upland grassland soil before and after a liming treatment to increase the numbers of large soil fauna. Bacterial cells were located by image analysis of stained thin sections and densities calculated from these data. Excrement from macro- and meso-fauna was identified using micromorphology and the densities of bacteria on specific areas of excrement measured by image analysis. There were significant differences among horizons in the density of bacterial cells, with the minimum density found in the horizon with least evidence of earthworm activity, but no difference in density between the organic H and organo-mineral Ah horizons. Soil improvement by liming significantly increased bacterial densities in all three horizons, with the greatest increase found in the horizon with the smallest density before liming. There were no differences in bacterial density between areas dominated by excrement from earthworms and excrement from enchytraeids, although densities in both areas were significantly increased by liming. Variability in bacterial density at spatial scales of less than 1 mm was linked to the occurrence of excrement. Bacterial densities within areas of both types of excrement were significantly greater than those in the surrounding soil. However, the frequency distribution of the ratios of density in excrement to that in the soil was bimodal, with a majority of occurrences having a ratio near 1 and only some 20-30% having a much larger ratio. These variations can probably be explained by variations in the age of the excrement and its suitability as a substrate.