More than two-thirds of STEM jobs are held by men. This paper provides a detailed analysis of the STEM pipeline from high school to mid-career in the United States, decomposing the gender gap in STEM into six stages. By far the most important stages are the initial college major choice and the college-to-career transition. Men are far more likely than women to start in a STEM major, especially among those who are the most prepared for STEM upon entry. This alone accounts for 57% of the total gender gap in STEM careers. After college, male STEM graduates are far more likely to be found in a STEM job, accounting for 44% of the overall gap. Women who start in STEM majors are also less likely to graduate in STEM (accounting for 16%), while the gap in pre-college STEM-readiness is a small factor (8%). Women attend college at much higher rates than men, which works to reduce the final gender gap in STEM (-14%). The pipeline to STEM jobs is complex, and focusing only on the college experience or only on the labor market misses a large part of the overall story of women in STEM.