Recent studies report significant increases in retirement ages over the past two to three decades in most countries in the Organization for Economic Co-operation and Development—increases that research has attributed mainly to changes in the legislative frameworks for retirement in these countries. Using unique data from the Danish Longitudinal Study of Ageing, this study investigates whether and, if so to what extent, changes to the workforce in terms of gender, education, employment status (employed or self-employed) and health contribute to explaining differences in retirement ages between the cohorts born in 1935 and 1950. The retirement window of these cohorts stretches from the early 1990s to the late 2010s—a period characterized by substantial changes to workforce. On average, retirement ages increased by two years from the 1935 cohort to the 1950 cohort. However, due to changes in the investigated factors having offsetting effects, the net effect of such changes on retirement ages was minor. Thus, while increasing levels of education and better health among older workers contributed to increasing retirement ages, increasing female labour force participation and fewer self-employed workers had the opposite effect. In absolute terms, the total compositional and behavioural influence on retirement ages of changes in terms of employment status (− 0.35 years) was almost as large as the total changes in terms of education (0.44 years). Thus, future studies investigating long-term changes in retirement ages would benefit from including changes in employment status (self-employed or wage earner) as an explanatory factor.Supplementary InformationThe online version contains supplementary material available at 10.1007/s10433-023-00771-0.