& Key message The carbon density was not different between natural and planted forests, while the biomass carbon density was greater in natural forests than in planted forests. The difference is due primarily to the larger carbon density in the standing trees in natural forests compared to planted forests (at an average age of 50.6 and 15.7 years, respectively). & Context Afforestation and reforestation programs might have noticeable effect on carbon stock. An integrated assessment of the forest carbon density in mountain regions is vital to evaluate the contribution of planted forests to carbon sequestration. & Aims We compared the carbon densities and carbon stocks between natural and planted forests in the Lüliang Mountains region where large-scale afforestation and reforestation programs have been implemented. The introduced peashrubs (Caragana spp.), poplars (Populus spp.), black locust (Robinia pseudoacacia), and native Chinese pine (Pinus tabulaeformis) were the four most common species in planted forests. In contrast, the deciduous oaks (Quercus spp.), Asia white birch (Betula platyphylla), wild poplar (Populus davidiana), and Chinese pine (Pinus tabulaeformis) dominated in natural forests. & Methods Based on the forest inventory data of 3768 sample plots, we estimated the values of carbon densities and carbon stocks of natural and planted forests, and analyzed the spatial patterns of carbon densities and the effects of various factors on carbon densities using semivariogram analysis and nested analysis of variance (nested ANOVA), respectively. & Results The carbon density was 123.7 and 119.7 Mg ha −1 for natural and planted forests respectively. Natural and planted forests accounted for 54.8% and 45.2% of the total carbon stock over the whole region, respectively. The biomass carbon density (the above-and belowground biomass plus dead wood and litter biomass carbon density) was greater in natural forests than in planted forests (22.5 versus 13.2 Mg ha −1). The higher (lower) spatial carbon density variability of natural (planted) forests was featured with a much smaller (larger) range value of 32.7 km (102.0 km) within which a strong (moderate) spatial autocorrelation could be observed. Stand age, stand density, annual mean temperature, and annual precipitation had statistically significant effects on the carbon density of all forests in the region. & Conclusion No significant difference was detected in the carbon densities between natural and planted forests, and planted forests have made a substantial contribution to the total carbon stock of the region due to the implementation of large-scale afforestation and reforestation programs. The spatial patterns of carbon densities were clearly different between natural and planted forests. Stand age, stand density, temperature, and precipitation were important factors influencing forest carbon density over the mountain region.