We explore the association between urban density and pupil attainment using three cohorts of pupils in schooling in England. Although as widely recognised attainment in dense urban places is low on average, this is not because urban environments disadvantage pupils, but because the most disadvantaged pupils with low average attainments attend the most urbanised schools. To control for this, we exploit changes in urban density faced by pupils during compulsory transition from Primary to Secondary school, and measure educational progress at the end of the Secondary phase, relative to attainment at the end of Primary schooling. Our results suggest that there are small but significant benefits from education in schools in more densely urbanised settings. We detect this density advantage even amongst pupils moving relatively short distances between Primary and Secondary schools within urban areas, so we cannot attribute it to broad urbanisation effects experienced by pupils making rural-urban school moves. A more likely explanation lies in greater school choice and competition between closely co-located educational providers.