BACKGROUND: Recognizing the effect of the digital economy on residents' health can transform technological dividends into health and well-being and provide the basis for the construction of a "health-oriented" digital society development path. METHODS: This paper explores the direct impact of the digital economy on residents' health and its mechanism by constructing a digital economic development index and combining data from the China Family Panel Studies (CFPS). RESULTS: The digital economy has a health-improving effect. At the individual level, the mechanism is to accumulate social capital and improve the quality of employment, whereas at the regional level, the mechanism is to promote the equalization of basic public services and improve the quality of the environment. The effectiveness of government governance plays a beneficial moderating role in this mechanism. The heterogeneity analysis shows that the digital economy had a more significant effect on the central, western, rural, and economically underdeveloped cities, as well as on males and the low-health group. Further analysis reveals that the digital economy increases intergenerational health mobility and helps alleviate health inequalities. CONCLUSIONS: This paper not only enriches the study of health determinants but also provides a reference for collaboration between global digitalization and health governance.