Abstract Taking non-financial listed companies on the Shanghai and Shenzhen Stock Exchanges from 2011 to 2022 as the research objects, this paper uses text analysis methods to measure the digital transformation of companies. It explores the impact and mechanism of excessive debt on the digital transformation of companies, and further analyzes the heterogeneous effects of this impact on companies with different characteristics. The results show that the digital transformation of enterprises can effectively restrain excessive debt, which is still true after a series of robustness tests. The results of mechanism test show that digital transformation inhibits excessive debt of enterprises by improving corporate information transparency and easing corporate financing constraints. The results of further heterogeneity analysis show that in high profitability, high internal governance and non-state-owned enterprises, digital transformation has a more significant inhibition effect on excessive debt. The research conclusion not only expands the relevant literature on the economic consequences of enterprise digital transformation, but also provides a new idea for the governance of enterprises’excessive debt.