As a nature-based and cost-effective solution, forestation plays a crucial role in combating global warming, biodiversity collapse, environmental degradation, and global well-being. Although China is acknowledged as a global leader of forestation and has achieved considerable overall success in environmental improvements through mega-forestation programs, many negative effects have also emerged at local scales due to the planting of maladapted tree species. To better help achieve carbon neutrality and the new vision of an ecological civilization, China has committed to further increase forestation. However, where forestation lands and such efforts should really be located is not so well understood yet and agreed upon, especially in the face of rapid climate change. Based on an ensemble-learning machine, we predicted the spatial habitats (ecological niche) of the forest, grassland, shrubland, and desert under present and future climate conditions based on the natural climax vegetation distribution across China. We show that the potential forestation lands are mainly located in eastern China, which is east of the Hu Line (also known as the Heihe-Tengchong Line). Under future climate change, forests will shift substantially in the latitudinal, longitudinal, and elevational distribution. Potential forestation lands will increase by 33.1 million hectares through the 2070s, mainly due to the conversions of shrub and grassland to forests along the Hu Line. Our prediction map also indicates that grassland rehabilitation is the universal optimal vegetation restoration strategy in areas west of the Hu Line. This analysis is consistent with much of the observed evidence of forestation failures and recent climate-change-induced forest range shifts. Our results provide an overview and further show the importance of adaptive science-based forestation planning and forest management.