We investigated whether living close to railway lines is a risk factor for childhood leukaemia and non-Hodgkin's lymphoma in electoral wards in England and Wales, 1966 -1987. The national rail network, 1966 -1987, was digitised and the numbers of cases in each ward were related to two measures of environmental exposure to railways: a proximity and a density function, contributions to these functions being weighted by the frequency of use and time in use of each stretch of railway. Poisson regression was used to derive rate ratios in relation to these measures of exposure to railways, both unadjusted and adjusted for population mixing. We found no association between risk of leukaemia and railway proximity (unadjusted rate ratio for trend from the lowest to the median value ¼ 1.006, 95% CI: 0.998 -1.013, P ¼ 0.14) and a very small association with railway density, of marginal statistical significance (rate ratio for trend ¼ 1.001, 95% CI: 1.000 -1.003, P ¼ 0.05). This effect depended on two deprived, urban wards with high railway density and high population mixing and became nonsignificant (P ¼ 0.09) after allowing for population mixing. The very weak association between railway density and risk of childhood leukaemia is likely to be a consequence of the association between population mixing and proximity to railways in very deprived, urban wards.