Nowadays, working from home (WFH) has become a popular work arrangement due to its many potential benefits for both companies and employees (e.g., increasing job satisfaction and retention of employees). Many previous studies have investigated the impact of WFH on the productivity of employees. However, most of these studies usually use a qualitative analysis method such as surveys and interviews, and the studied participants do not work from home for a long continuing time. Due to the outbreak of coronavirus disease 2019 (COVID-19), a large number of companies asked their employees to work from home, which provides us an opportunity to investigate whether WFH affects their productivity. In this study, to investigate the difference in developer productivity between WFH and working onsite, we conduct a quantitative analysis based on a dataset of developers’ daily activities from Baidu Inc., one of the largest IT companies in China. In total, we collected approximately four thousand records of 139 developers’ activities of 138 working days. Out of these records, 1103 records are submitted when developers work from home due to the COVID-19 pandemic. We find that WFH has both positive and negative impacts on developer productivity in terms of different metrics, e.g., the number of builds/commits/code reviews. We also notice that WFH has different impacts on projects with different characteristics including programming language, project type/age/size. For example, WFH has a negative impact on developer productivity for large projects. Additionally, we find that productivity varies for different developers. Based on these findings, we get some feedback from developers of Baidu and understand some reasons why WFH has different impacts on developer productivity. We also conclude several implications for both companies and developers.