In this study we use administrative data from three large urban school districts to describe student sorting within schools. Our data allow us to link students to each of their teachers and to identify students’ classmates. We find differences in the average achievement levels, the racial composition, and the socioeconomic composition of classrooms within schools. This sorting occurs even in self-contained elementary school classrooms and is much larger than would be expected if students were assigned to classrooms randomly. Much, but not all, of the racial and socioeconomic sorting we document is accounted for by differences in achievement, particularly at the high school level. Classrooms with the largest composition of low-achieving, minority and poor students are also more likely to have novice teachers. The process of sorting students by their achievement level has the consequence of exposing minority and poor students to lower quality teachers and less-resourced classmates.