This paper estimates an education production function using data on the College Scholastic Ability Test (CSAT) score and high school characteristics from Seoul, Korea.1 A unique institutional feature of the high school system in Seoul is that on entering high school students are randomly assigned to schools within each school district. The main contribution of our study is to derive a school production function by aggregating the individuals’ potential outcome functions that depend on observed and unobserved school inputs interacted with heterogeneous and unobserved individual abilities. The school production function derived under random assignment and under the assumption that there are no cohort effects has three unique features that have not been considered in previous studies. First, its average (over students) coefficients on school inputs do not differ by school or over time, but by district. This is a consequence of the endogenous sorting of students between districts 2. combined with the random assignment to schools within districts. Second, it allows unobserved school effects to be potentially correlated with observed ones. Third, the weighted average of the district-specific school input effects with weights equal to the fraction of the population in the districts is equal to the average partial effect (APE) of school inputs on individual academic achievement. To estimate the school production function coefficients, we first obtain district-specific coefficients using the fixed effect estimation method in school level panel data for each district and compute the weighted average described above. The empirical findings are (i) the school production function coefficients do differ between districts, which may be due to potentially endogenous sorting of students or unobserved differences in district characteristics, (ii) our estimate of the single-sex school effect is much larger than that found in previous studies most of which assumed constant school input coefficients across districts and did not consider school fixed effects.