Reducing carbon emissions is a crucial way to achieve sustainable development. Whether the digital economy helps or makes it harder to cut emissions is a matter of debate. This paper proposes a new digital economy index based on the entropy weight method. The two-way fixed effect panel model is used to analyze the data of 30 provinces in China from 2011 to 2021. The results suggest that (1) The digital economy can significantly reduce carbon emissions. (2) Improving energy efficiency and promoting energy structure transformation are two essential mechanisms for carbon reduction in the digital economy. (3) There is heterogeneity in the impact of the digital economy on carbon emissions. The digital economy significantly reduces carbon emissions from coal but does not significantly impact carbon emissions from other sources. Moreover, the emission reduction effect of the digital economy is related to regional energy endowment, intelligent manufacturing level, and industrial agglomeration level. This paper provides new empirical evidence for clarifying the relationship between the digital economy and carbon emissions and provides policy implications for promoting the realization of carbon neutrality goals.