Digitalization, as a crucial engine for promoting sustainable development, has created new prospects for enterprise green transformation. Utilizing panel data from enterprises registered in China's resource-based cities from 2010 to 2021, this study innovatively examines the role of digitalization in promoting green transformation across two key performance dimensions. The findings indicate that enterprise digitalization significantly enhances the green innovation performance, while its impact on environmental performance, although positive, is not statistically significant. Overall, enterprise digitalization greatly facilitates green transformation. Moreover, mechanism analysis reveals that enterprise digitalization promotes green transformation through the alleviation of financial mismatch and the increase of external market attention. In addition, heterogeneity analysis shows that the effectiveness of enterprise digitalization in promoting green transformation is significantly different in different opportunist risk scenarios, proving more effective in areas with low-marketization, high-competition industries, and high environmental regulation intensity. In terms of the policy level, the National Big Data Comprehensive Pilot Zone (NBDCPZ) and the Carbon Emission Trading Policy (CETP) played a positive stimulating role in the process of enterprise digitalization affecting green transformation. This paper broadens the scope of research on green transformation, offers new development philosophy for enterprises in resource-based cities, and provides new directions for the synergistic development of digitalization and greenization. • We explore the nexus between digitalization and green transformation. • We verify this positive effect by applying multiple fixed-effects models. • We identify the mechanism paths from the perspective of external market attention. • We implement heterogeneity analysis from three aspects. • We reinforce the reliability of this positive effect under considering policy interference. [ABSTRACT FROM AUTHOR]