We study whether female students benefit from being taught by female professors, and whether such gender match effects differ by class size. We use administrative records of a German public university, covering all programs and courses between 2006 and 2018. We find that gender match effects on student performance are sizable in smaller classes, but do not exist in larger classes. This difference suggests that direct and frequent interactions between students and professors are important for the emergence of gender match effects. Instead, the mere fact that one’s professor is female is not sufficient to increase performance of female students.