This study develops an analytical framework for evaluating the respective contributions of pupils, peers, and school quality in affecting educational achievement. We implement this framework using rich data from England that matches pupils to their primary schools. The dataset records all English pupils and their test scores in Key Stage 1 (age 7) and Key Stage 2 (age 11) national examinations. The quality of the data source, coupled with our econometric techniques, allows us to assess the respective importance of different educational inputs. We can distinguish school effects that affect all pupils irrespective of their year and grade of study, from school-grade-year effects. Identification of pupil effects separately from these school-grade-year effects is achieved because students are mobile across schools. Peer effects are identified assuming variations in school-grade-year group composition in adjacent years are exogenous. We estimate three different specifications, the most general allowing Key Stage 2 results to be affected by the Key Stage 1 school(-grade-year) at which the pupil studied. We discuss the validity of our various exogeneity assumptions. Estimation results show statistically significant pupil ability, school and peer effects. Our analysis suggests the following ranking: pupils' ability and background are more important than school time-invariant inputs. Peer effects are significant, but small.