Climate change must deal with two market failures, global warming and learning by doing in renewable use. The social optimum requires an aggressive renewables subsidy in the near term and a gradually rising carbon tax which falls in long run. As a result, more renewables are used relative to fossil fuel, there is an intermediate phase of simultaneous use, the carbonfree era is brought forward, more fossil fuel is locked up and global warming is lower. The optimal carbon tax is not a fixed proportion of world GDP. The climate externality is more severe than the learning by doing one.