We investigate how digital transformation affects corporate risk-taking by using the data of China’s A-share listed companies from 2012 to 2021, and examines the mediating role of managerial ability. The results demonstrate that digital transformation is significantly and positively related to managerial ability, which promotes corporate risk-taking. We also provide further evidence that the impact of digital transformation on corporate risk-taking becomes more pronounced as economic policy uncertainty increases. Additionally, the results indicate that the role of digital transformation in improving corporate risk-taking is more significant in high-tech firms. Furthermore, we discover that by increasing corporate risk-taking, digital transformation further promotes firms’ total factor productivity (TFP). Our findings supplement the literature on the influencing mechanism between digital transformation and corporate risk-taking from the perspective of managerial initiatives and provide more specific and feasible recommendations for firms.