Digital transformation has become a wave sweeping across the globe, affecting all industries with unprecedented speed and breadth, and it is urgent to introduce digital transformation into the corporate social responsibility (CSR) field. This study aims to investigate the impact of digital transformation on CSR performance and its influencing mechanism. The findings are as follows: (1) digital transformation can improve CSR performance; (2) from the dual perspective of internal drive and external governance, we figure out that digital transformation improves CSR performance by improving green management innovation and analyst coverage; (3) further analysis shows that the impact of digital transformation on CSR performance differs under different resource endowments and institutional environments (i.e., formal and informal institutions). Specifically, this promoting effect is only reflected incorporates more resources (i.e., human resources, cultural resources, employment resources, and economic resources), with strong environmental enforcement or high media attention. In the context of digital transformation, this study enriches the mechanism of improving CSR performance and is of great practical significance for corporates, markets, governments and other stakeholders. Meanwhile, the findings of this study are of practical guidance for promoting corporates to fulfill their social responsibility and achieve sustainable development goals in the digital era.