This paper studies the effects of health on optimal taxation of labour income, capital income and health care spending using a general equilibrium overlapping generations model, where health affects the level of utility, life expectancy and labour productivity. Our analytical results show that with endogenous life expectancy the optimal capital income tax is non-zero, even if the government can condition labour income taxes on age. In our model the government can influence the demographic structure of the economy and it is optimal to distort the consumption path of the households. Furthermore, our results suggest that the optimal capital income tax adjust to changes in longevity, even if the ageing of the population is fiscally neutral. Households save for a longer horizon, resulting in more inelastic savings and less distortive taxation of capital income.