The use of fossil energy highly contributes to the CO2 emissions. Compared to other countries, China and the USA were responsible for approximately half of the global CO2 emissions in 2022. The SDG7 agenda, which aims to preserve the use of renewable energy, has made people aware of the need to switch from fossil-based to renewable energy sources by 2030. Thus, this paper aims to analyze the implications of fossil and renewable energy consumption on environmental degradation in the USA and China. This study uses the linear and nonlinear autoregressive distributed lag (ARDL) model to examine the cointegration of the fossil and renewable energy toward the CO2 emissions from 1985 to 2021. The estimation results for USA using linear ARDL shows that fossil energy lead to higher CO2 emissions, meanwhile renewable energy reduces the CO2 emissions. Similar finding in the nonlinear ARDL, most of the models for China and the USA found significant impact of renewable energy consumption, where higher renewable energy transition contributes in lowering environmental degradation. This provide justification for policymakers in both countries to continue their efforts in renewable energy transition to archive the SDG7 agenda in 2030.