Abstract. While the carbon (C) content of temperate and boreal forest soils is relatively well studied, much less is known about the ratios of C, nitrogen (N), and phosphorus (P) of the soil organic matter, and the abiotic and biotic factors that shape them. Therefore, the aim of this study was to explore carbon, nitrogen, and organic phosphorus (OP) contents and element ratios in temperate and boreal forest soils and their relationships with climate, dominant tree species, and soil texture. For this purpose, we studied 309 forest soils with a stand age >60 years located all over Sweden between 56° N and 68° N. The soils are a representative subsample of Swedish forest soils with a stand age >60 years that were sampled for the Swedish Forest Soil Inventory. We found that the N stock of the organic layer increased by a factor of 7.5 from −2 °C to 7.5 °C mean annual temperature (MAT), it increased almost twice as much as the organic layer stock along the MAT gradient. The increase in the N stock went along with an increase in the N : P ratio of the organic layer by a factor of 2.1 from −2 °C to 7.5 °C MAT (R2 = 0.36, p < 0.001). Forests dominated by pine had higher C : N ratios in the litter layer and mineral soil down to a depth of 65 cm than forests dominated by other tree species. Further, also the C : P ratio was increased in the pine-dominated forests compared to forests dominated by other tree species in the organic layer, but the C : OP ratio in the mineral soil was not elevated in pine forests. C, N and OP contents in the mineral soil were higher in fine-textured soils than in coarse-textured soils by a factor of 2.3, 3.5, and 4.6, respectively. Thus, the effect of texture was stronger on OP than on N and C, likely because OP adsorbs very rigidly to mineral surfaces. Further, we found, that the P and K concentrations of the organic layer were inversely related with the organic layer stock. The C and N concentrations of the mineral soil were best predicted by the combination of MAT, texture, and tree species, whereas the OP concentration was best predicted by the combination of MAT, texture and the P concentration of the parent material in the mineral soil. In the organic layer, the P concentration was best predicted by the organic layer stock. Taken together, the results show that the N : P ratio of the organic layer was most strongly related to MAT. Further, the C : N ratio was most strongly related to dominant tree species, even in the mineral subsoil. In contrast, the C : P ratio was only affected by dominant tree species in the organic layer, but the C : OP ratio in the mineral soil was hardly affected by tree species due to the strong effect of soil texture on the OP concentration.