Over the last decade, many countries have experienced dramatic increases in university enrolment, which, when not matched by compensating increases in other inputs, have resulted in larger class sizes. Using administrative records from a leading UK university, we present evidence on the effects of class size on students' test scores. We observe the same student and faculty members being exposed to a wide range of class sizes from less than 10 to over 200. We therefore estimate non-linear class size effects controlling for unobserved heterogeneity of both individual students and faculty. We find that (i) at the average class size, the effect size is -0.108; (ii) the effect size is however negative and significant only for the smallest and largest ranges of class sizes and zero over a wide range of intermediate class sizes; (iii) students at the top of the test score distribution are more affected by changes in class size, especially when class sizes are very large. We present evidence to rule out class size effects being due solely to the non-random assignment of faculty to class size, sorting by students onto courses on the basis of class size, omitted inputs, the difficulty of courses, or grading policies. The evidence also shows the class size effects are not mitigated for students with greater knowledge of the UK university system, this university in particular, or with greater family wealth.