Summary1. As many invertebrates are nocturnal, their spatial distribution and habitat preferences may change from day to night. Both aspects are examined for Gammarus pulex by testing the hypotheses: (i) a power function was a suitable model for the spatial distribution of the shrimps in both day and night; (ii) diurnal and nocturnal spatial distributions were significantly different; (iii) diurnal and nocturnal habitat preferences were significantly different. Five different life‐stages were treated separately. To ensure that the conclusions were consistent, large samples were taken near midday and midnight in April, June and November over 4 years at two sites about 3 km apart in a stony stream: downstream (n = 30) and upstream (n = 50).2. The first and second hypotheses were supported at both sites. A power function, relating spatial variance (s2) to mean (m), was an excellent fit in all analyses (P < 0.001, r2 > 0.91), i.e. the spatial variance was density‐dependent. All five life‐stages were aggregated in the day. At night, the degree of aggregation increased for juveniles at higher densities but decreased for juveniles at lower densities, increased for immature females and males, but decreased slightly for mature females and especially mature males, the latter being close to a random distribution. There were no significant differences between sites, in spite of the lower numbers at the downstream site.3. The third hypothesis was tested at only the upstream site and supported by comparisons between shrimp densities and 13 physical variables (distance from bank, water depth, water velocity, ten particle size‐classes), and three non‐physical variables (dry weights of bryophytes, leaf material, organic detritus). During the day, densities were strongly related to particle sizes with the following preferences: 0.5–8 mm for juveniles, 8–256 mm for the other life‐stages with a weaker relationship for males. There were no significant positive relationships with the other variables, apart from bryophytes for immature shrimps and adults. At night, densities were unrelated to particle size; juveniles and immature shrimps preferred low water velocities near the banks, often where leaf material and organic detritus accumulated, females often preferred medium water velocities slightly away from the banks, and males showed no habitat preferences.4. Day samples do not provide a complete picture of habitat preferences and probably identify refuge habitats. Day–night changes in spatial distribution and habitat preferences are an essential part of the behavioural dynamics of the shrimps and should be investigated in other species.