This paper examines the effects of digital finance and corporate stock price crash risk, and the underlying mechanisms, using panel data from Chinese A-share listed companies between 2012 and 2021. Specifically, we focus on whether digital transformation and environmental, social, and governance (ESG) performance are intermediary channels through which digital finance mitigates corporate stock price crash risk. By employing panel regression and mediation effect models, we demonstrate that digital finance significantly reduces corporate stock price crash risk. This conclusion remains robust after a series of robustness tests, including the replacement of core explanatory variables, lagging digital finance by one period, using alternative dependent variables, applying the instrumental variables method, and system GMM estimation. More importantly, we find that digital finance curbs stock price crash risk by enhancing digital transformation and ESG performance. In addition, we reveal that digital finance has heterogeneous effects on corporate stock price crash risk. The inhibitory effect of digital finance on stock price crash risk is more pronounced in the central and western regions of China and for companies with lower internal control levels, higher information transparency, and higher financing constraints.