This study investigates the drivers behind migration from larger to smaller cities and from urban to rural areas (counter-urbanization), along with the reverse migration (re-urbanization) during and after the COVID-19 pandemic. Utilizing a retrospective survey of 1000 respondents across China from January 2020 to April 2023, we explored how pandemic-related factors influenced migration behaviors. A theoretical framework integrating push-pull, risk perception, and human capital theories was developed. Boxplot visualization was used to examine the motivations for counter-urbanization during the pandemic, and regression models were applied to identify the complex factors driving both counter-urbanization and re-urbanization. Key findings reveal that pandemic-induced insecurity and perceptions of the strictness and effectiveness of virus prevention measures significantly influenced migration decisions. Notably, land ownership in rural hometowns served as a crucial "safety net" for rural populations, affecting their migration decisions. This study differentiates between migration types: urban-to-rural versus larger-to-smaller cities, and compares the driving factors behind both processes. By focusing on both counter-urbanization and re-urbanization, this research highlights the interplay of psychological, policy, and economic factors that shape migration patterns in the context of public health crises.