The federal government and many individual organizations have invested in programs to support diversity in the STEM pipeline, including STEM summer programs for high school students, but there is little rigorous evidence of their efficacy. We fielded a randomized controlled trial to study a suite of such programs targeted to underrepresented high school students at an elite, technical institution. The STEM summer programs differ in their length (one week, six weeks, or six months) and modality (on-site or online). Students offered seats in the STEM summer programs are more likely to enroll in, persist through, and graduate from college, with gains in institutional quality coming from both the host institution and other elite universities. The programs also increase the likelihood that students graduate with a degree in a STEM field, with the most intensive program increasing four-year graduation with a STEM degree attainment by 33 percent. The shift to STEM degrees increases potential earnings by 2 to 6 percent. Program-induced gains in college quality fully account for the gains in graduation, but gains in STEM degree attainment are larger than predicted based on institutional differences.