The low fertility rate in China has become a pressing issue. Previous studies have focused on the relationship between socioeconomic status (SES) factors and fertility. However, from a life course perspective, both childhood family SES and adulthood SES may influence fertility outcomes. This study explores the relationship between childhood family SES, adulthood SES, and fertility behavior using data from the China Health and Retirement Longitudinal Study (CHARLS). The findings indicate a significant negative correlation between childhood family SES and fertility behavior in adulthood. Individuals from higher SES families in childhood tend to have fewer children as adults (IRR = 0.936, 0.949, 0.688, respectively). In terms of age heterogeneity, this study found that childhood SES also negatively affects fertility behavior among individuals born in 1957 or earlier. Additionally, adulthood SES serves as a significant mediator between childhood family SES and fertility. Individuals who grew up in urban areas tend to have fewer children than those raised in rural areas (Coef = -0.255, P < .001), and they tend to have fewer children as adults because of their higher adulthood SES (Coef = -0.115, P < .001). These results suggest that higher SES in both childhood and adulthood reduces fertility. Since socioeconomic status is difficult to alter through policy intervention, external policy measures and social support must be reinforced. Policies should focus on alleviating the pressures faced by people of childbearing age and providing favorable conditions for those who wish to have children.