Afforestation has been suggested as an effective ecological engineering approach for carbon sequestration and environmental benefits. However, the impact of afforestation on soil inorganic carbon (SIC) is less clear and sometimes controversial. Here, we conducted a field campaign, with 2346 soil profiles from 619 afforested plots and 163 control plots, to investigate the relative and absolute changes of SIC between afforested and corresponding control plots in northern China. We found positive responses of SIC to afforestation in acidic soils, where afforestation increased soil pH. In contrast, in alkaline soil, afforestation caused soil acidification and thus negative SIC responses. Fitting a structure equation model (SEM) confirmed that afforestation-induced soil pH change (ΔpH) was the most significant factor regulated SIC responses to afforestation. In particular, we observed stronger SIC sensitivity to pH change in arid areas, where both soil pH and SIC stocks were high. Other factors indirectly affected SIC responses to afforestation through modulating soil pH and soil organic carbon (SOC) dynamics. Afforestation-induced SIC changes also varied considerably among different planted tree species and across different soil depths. Specifically, in Pinus sylvestris var. mongholica, Pinus tabuliformis and Populus spp. plantations, changes of SIC were large enough to be comparable to that of SOC. Our finding provides a data-based comprehensive understanding on the impact of afforestation on SIC and its underlying mechanisms. With increased uses of afforestation and reforestation as potential nature-based climate solutions, decisions need to consider potential associated SIC changes, especially in SIC-rich areas.