We optimize timber and bioenergy production combined with carbon storage in Scots pine (Pinus sylvestris L.) stands, using an ecological-economic model. Forest growth is specified with a highly detailed process-based growth specification, and optimization is based on an efficient generalized pattern search algorithm. The optimized variables are rotation length, initial stand density, and the number, intensity, timing, and type of thinnings. The carbon pool includes all aboveground biomass (including dead trees) and timber products. The analysis includes the comparison of different carbon subsidy systems. The results are presented for the most relevant site types and thermal zones in Finland. Carbon storage increases the optimal rotation length, number of thinnings, and initial density at all forest sites. Carbon storage effects on stand density and harvests are strongest at poor sites. Timber output increases with carbon price. High natural mortality in our results implies notable carbon storage in dead trees and a positive contribution to biodiversity. The stand-level analysis is extended to a cost-efficient national-level carbon storage plan.