This study assesses the impacts of the COVID-19 pandemic on Chinese residents' food safety knowledge and behavior, and explores the possible influence mechanism, namely, focus on media information. The study is based on internet survey data of 1 373 residents in China. A series of econometric models are developed to estimate food safety knowledge and behavior of residents. Both the descriptive and econometric results indicate that the existence of COVID-19 cases in a community has a significantly positive effect on residents' food safety knowledge and behavior. Residents focusing on food safety-related information tend to have higher food safety knowledge and practice food safety behavior. When controlling the variable focused on food safety-related information, the marginal effects of the existence of COVID-19 cases in a community on residents' food safety knowledge and behavior significantly decrease. However, the decrease in consumers' food safety knowledge is quite minor. Hence, the COVID-19 pandemic indeed improves Chinese residents' food safety knowledge and behavior, while focus on food safety-related information is an important mechanism for improving food safety behavior. Moreover, the estimation results of the simultaneous equations model reveal that consumers' food safety knowledge has a significant and positive effect on their food safety behavior. Heterogeneous impacts of the COVID-19 pandemic on residents' food safety knowledge and behavior among different regions and income groups are observed. The findings of this study provide evidence that public health events could enhance residents' safety awareness and behavior, while residents' focus on relevant information plays an important role in improving knowledge and impacting behavior.