Sexual selection echoed by the sex ratio is a critical issue in evolution and reproductive biology studies, and the second sex ratio (sex ratio at birth, SRB) is an important evaluation indicator for sex regulation. However, broad debates on sex ratio at birth exist due to the lack of a clear spatiotemporal genealogical database. This study explicitly tests the Trivers and Willard’s hypothesis stating that parents with good social conditions tend to show a male-biased SRB. Using a database of Chinese imperial families from 211BC to 1912 (2142 years) which avoids the spatiotemporal confusion of data thanks to its clear boundaries and long timespan, we found that a proportion of males at birth was 0.54. In particular, the results indicate that the empresses generated a significantly higher male-biased SRB than the concubines within the imperial harems (0.61 vs 0.53), while the SRB of concubines was not higher than ordinary people (0.53 vs 0.52). A significant difference of SRB before and after empress coronation (0.48 vs 0.65) was detected, indicating that the change to a higher social status is the leading cause of a biased SRB. These findings suggest that mothers with privileged instant social conditions tend to generate more boys than girls. In other words, a higher maternal social rank during the conception period, instead of rich resources, forms the primary mechanism regulating the SRB.Significance statementAdaptive sex ratio has been a debatable topic difficult to clearly verify since the publication of Trivers and Willard Hypothesis in 1973, which proposes that parents who have good conditions should produce more male offspring. The one reason is that the validity and sample size of the databases used contained unavoidable confounding noise, both genealogically and genetically. To overcome these issues, we specifically compiled a historical database of Chinese imperial families, which are characterized by a confined mating harem and unique eunuch system, guaranteeing biological and genetic purity with precise genealogical relationships and genetic linkages between the parents and the offspring. Thus, this is an extraordinary effort to clarify the hypotheses proposed by TWH and other hypotheses.