This paper investigates the importance of the age composition for pandemic policy design. To do so, it introduces an economic framework with age heterogeneity, individual choice, and incomplete information, emphasizing the value of testing. Calibrating the model to the US Covid-19 pandemic reveals an 80% reduction in death toll due to voluntary actions and the lockdown implemented in the United States. The optimal lockdown, however, is more stringent than what was implemented in the United States. Moreover, the social planner follows an asymmetric approach by locking down the young relatively more than the old. We underscore the importance of testing, showing its impact on reduced deaths, lower economic costs and laxer lockdown. We use the framework to provide systematic insights into pandemics caused by different viruses (among others the Spanish flu), and underline the influence of economic conditions on optimal policies.