Despite the increasing demand for a scientifically and technologically literate population willing to pursue careers in science, technology, engineering, and mathematics (STEM), we know little about the reasons behind some social groups’―above all women and ethnic minorities―underrepresentation in these fields. While research has suggested a positive link between parental STEM occupation and students' achievement in STEM, it is yet unclear whether girls and boys with and without migration background benefit equally from having STEM-affiliated parents, and whether this relationship varies depending on the educational stage. Using nationally representative data from standardized assessment tests, we explore gender and ethnic differences in the association of parental STEM occupation and students’ achievement in STEM at two educational stages (fourth and ninth grade) in Germany.