The gender gap in STEM widens during high school due both to differences in student choices and institutional barriers to accessing STEM education. Using rich data from Mexico City's centralized assignment system and a structural model of high school choice, we document strong demand for elite STEM programs and relatively weak demand for non-elite STEM programs. Decomposition and counterfactual simulations demonstrate that most of the gap is due to gendered choices, with males more strongly preferring STEM. Test-based assignment restricts elite STEM access for females, who have lower placement test scores despite similar low-stakes exam scores. (JEL I21, I24, I26, J16, J24, O15)