Stellar X-ray and extreme ultraviolet (XUV) radiation is an important driver of the escape of planetary atmospheres. Young stars emit high XUV fluxes that decrease as they age. Since the XUV emission of a young star can be orders of magnitude higher compared to an older one, this evolution has to be taken into account when studying the mass-loss history of a planet. The temporal decrease of activity is closely related to the operating magnetic dynamo, which depends on rotation and convection in Sun-like stars. Using a sample of nearby M dwarfs, we study the relations between age, rotation and activity and discuss the influence on planets orbiting these low-mass stars.