Reduction of energy consumption in the building sector has been identified as a major instrument to tackle global climate change and improve sustainability. In this paper, we propose a methodology to address a retrofit planning problem at a community level, with a building resolution. The resulting tool helps local decision-makers identify pertinent actions to improve the environmental behavior of their territories. Two building retrofit levers are considered, namely envelope insulation and heating systems replacement. Retrofit planning is treated here as a single-objective optimization problem aimed at reducing the total costs of retrofit actions by minimizing their net present value. A multidimensional multiple-choice knapsack problem formulation is proposed through the adoption of adequate decision variables. It suitably balances the complexity induced by the large number of potential retrofit action combinations and the number of variables in the problem and permits a linear formulation. An optimization of virtual building stocks is performed to highlight the developed model’s capacity to tackle large problems (5,000 buildings) in a few minutes. Finally, three analyses finally are led on a real case-study territory, featuring both appropriate retrofit solutions and building stock information. Long-term evaluation of retrofit strategies over the short-term results in an additional 10% reduction of energy consumption and greenhouse gases emissions and encourages thermal insulation. When targeting a 40% reduction in energy demand, retrofit costs ranging from 20 to 800€/m2 are observed. Finally, the developed method was used to draw a CO2 abatement cost curve at territory level. A 70% reduction of emissions can be achieved with costs under 50 €/tCO2e.