Using the Super-SBM method, this study calculates the carbon emission efficiency (CEE) of 30 provinces in mainland China from 2011 to 2019. Then, using the systematic GMM model, spatial Durbin model, and mediating effect model, it examines the direct effect, spatial effect, and influence mechanism of the digital economy (DE) on CEE. It was found that (1) the DE significantly promoted regional CEE, but had a negative effect on CEE in provinces with high economic correlation; (2) mechanism studies showed that the DE improved CEE by reducing energy intensity, promoting industrial upgrading and green technology innovation; (3) regional heterogeneity analysis found that the DE significantly improved CEE in eastern provinces, but not in central and western provinces. DE improves CEE in provinces with high level of economic development, but decreases CEE in provinces with low level of economic development.This paper provides some empirical and theoretical references for the development of DE to improve CEE.