We estimate the causal impact of school and classroom gender composition on achievement. We take advantage of the random assignment of Korean middle school students to single-sex schools, co-educational (coed) schools with single-sex classes, and coed schools with mixed-gender classes. Male...