Using unique data on preference rankings for all high school students who apply for college in Ireland, we investigate whether, conditional on absolute achievement, within school-cohort rank in English and math affects choice of college major. We find that higher rank in math increases the likelihood of choosing STEM and decreases the likelihood of choosing Arts and Social Sciences. Similarly, a higher rank in English leads to an increase in the probability of choosing Arts and Social Sciences and decreases the probability of choosing STEM. The rank effects are substantial, being about one third as large as the effects of absolute performance in math and English. We identify subject choice in school as an important mediator - students who rank high in math are more likely to choose STEM subjects in school and this can partly explain their subsequent higher likelihood of choosing STEM for college. We also find that English and math rank have significant explanatory power for the gender gap in the choice of STEM as a college major - they can explain about 36% as much as absolute performance in English and math. Overall, the tendency for girls to be higher ranked in English and lower ranked in math within school-cohorts can explain about 6% of the STEM gender gap in mixed-sex schools and about 16% of the difference in the STEM gender gap between mixedsex schools and same-sex schools. Notably, these effects occur even though within-school rank plays no role whatsoever in college admissions decisions.