In the United States, women are more likely than men to enter and complete college, but they remain underrepresented among baccalaureates in science-related majors. We show that in a cohort of college entrants who graduated from high school in 2004, men were more than twice as likely as women to complete baccalaureate degrees in science, technology, engineering, and mathematics (STEM) fields, including premed fields, and more likely to persist in STEM/biomed after entering these majors by sophomore year. Conversely, women were more than twice as likely as men to earn baccalaureates in a health field, although persistence in health was low for both genders. We show that gender gaps in high school academic achievement, self-assessed math ability, and family-work orientation are only weakly associated with gender gaps in STEM completion and persistence. Gender differences in occupational plans, by contrast, are strongly associated with gender gaps in STEM outcomes, even in models that assume plans are endogenous to academic achievement, self-assessed math ability, and family-work orientation. These results can inform efforts to mitigate gender gaps in STEM attainment.