This paper shows that optimal unemployment insurance contracts are age-dependent. Older workers have only a few years left on the labor market prior to retirement. This short horizon implies a more decreasing replacement ratio. However, there is a sufficiently short distance to retirement for which flat unemployment benefits can be the optimal contract. It is the result of the inability to reconcile both incentives and insurance for the soon-to-be-retired unemployed workers. We show that the unemployment benefit agency could take advantage of the retirement period to tax pensions in order to optimize the trade-off between insurance and incentives at the end of working life.Unemployment insurance; Retirement; Recursive contracts; Moral Hazar...