ImportanceSocioeconomic status (SES) is associated with dementia. However, the role of SES transitions in dementia is less explored; such evidence would be useful to understand whether social mobility is associated with healthy longevity at older ages.ObjectiveTo investigate the association of lifetime SES transition with risk of dementia.Design, Setting, and ParticipantsThis prospective cohort study, conducted from August 2010 to December 2016, used data from the Japan Gerontological Evaluation Study for participants aged 65 years or older from 31 different areas in Japan. Individuals with missing SES values, loss of follow-up, or new dementia onset 1 year or less from baseline were excluded. Data analysis was performed from April 2022 to April 2023.ExposureTransitions in SES across the life course.Main Outcomes and MeasuresThe main outcome was risk of dementia incidence and corresponding loss or gain of dementia-free periods in a lifespan. The incidence of dementia was identified with a national registry of long-term nursing care services.ResultsA total of 9186 participants (4703 men [51.2%]) were included. The mean (SD) age at baseline was 74.2 (6.0) years. Six SES transitions were identified: upward, stable-high, upper-middle, lower-middle, downward, and stable-low. During the follow-up period, 800 cases of dementia were identified. Many dementia risk factors, including lifestyle behaviors, comorbidities, and social factors, were associated with SES transition patterns. Compared with lower-middle SES, the lowest risk of dementia was observed for upward transition (hazard ratio [HR], 0.66; 95% CI, 0.57-0.74) followed by stable-high (HR, 0.77; 95% CI, 0.69-0.86), downward (HR, 1.15; 95% CI, 1.09-1.23), and stable-low (HR 1.45; 95% CI, 1.31-1.61) transition (P < .001 for linearity); there was no association of upper-middle transition with risk of dementia (HR, 0.91; 95% CI, 0.79-1.03). The greatest increases in dementia-free years in the lifespan were also associated with upward SES transition (eg, 1.8 years [95% CI, 1.4-2.2 years] at age 65 years), while the downward transition was associated with the largest loss in lifetime dementia-free years at 75 years or older (eg, −1.4 years [95% CI, −2.4 to −0.4 years] at age 85 years).Conclusions and RelevanceThis cohort study of Japanese older adults identified that upward and downward SES transitions were associated with risk of dementia and the length of dementia-free periods over the lifespan. The results may be useful to understand the association between social mobility and healthy longevity.