The COVID-19 pandemic forced schools and universities to transit from traditional class-based teaching to online learning. This paper investigates the impact produced by this shift on students’ performance. We use administrative data of four cohorts of students enrolled in an Italian University and adopt a difference-in-differences strategy exploiting the fact that the transition to online teaching has taken place at the beginning of the second semester, while classes were face-to-face in the first semester. We compare students’ performance in the second semester of 2020 with their performance in the first semester and contrast this difference with the difference between second and first semester in the previous academic years. Controlling for a number of variables proxying for COVID-19 incidence and internet connections’ quality, we find that online teaching has reduced students’ performance of about 1.4 credits per semester (0.11 Standard Deviations). Freshmen are those who suffer more, while almost no negative effect is found for Master’s Degree students. Since the need for self-discipline in an online environment could cause students’ low achievements, we study the role of procrastination and show that online teaching has been particularly detrimental for students affected by present-bias problems.