The existence of gender pay gap in the U.S. and other countries is clear. Most studies show that women earn roughly 20% less than comparable men.

But there is far less agreement on why this happens and how the gap can be closed. Is the gender pay gap due to more valuable (but hard to measure) labor market skills that men have or is it due to different “choices” regarding career-versus-family tradeoffs? And what about labor market discrimination against women? We may never fully understand the various drivers behind the gender pay gap, but it is nevertheless instructive to learn how men and women’s earnings evolve during the first 20 years of their careers.

Using enormous Census Bureau databases that allow researchers to track individual firms and their workers over time, we study the gender gap in average quarterly earnings from 1995 to 2008. We find that the earnings gap between college-educated men and women at the start of their careers is small, but by the time these individuals reach their career peak the gender pay gap is very large. The average male college graduate by his early forties earns roughly 55% percent more than the average college graduate female.

The data allow us to follow individuals within their existing jobs, as well as when they switch jobs. We show that most of the earnings divergence happens within firms: when men and women both stay with the same company, men enjoy much faster earnings growth. We also found that the pay gap widened when men and women switched jobs — as they age, college educated men shift to higher paying firms more than do women – but this difference was much smaller than the difference occurring between people who stayed in the same firm.

Our data allow us to observe some potential mechanisms that drive the growth of the gender earnings gap. In the first study we show that in the “between firms” gap – the gap that widens as men and women switch jobs — marriage plays a crucial role. Indeed, married women’s earning power seems to benefit very little from changing jobs. This factor is influential enough to explain a significant share of the earnings gap widening. In short, although married women change jobs with almost the same frequency as men do, they do not benefit from these moves in terms of earnings increases as men’s career moves tend to be towards better-paying firms, whereas married women’s moves are not. This may be related to a phenomenon called “tied migration.” Families make their location decisions based on the “primary career,” which usually is that of the husband. This is why job moves often only benefit that primary career and could even hurt the secondary career. Conversely, unmarried women tend to benefit from job mobility in a way that more closely resembles both married and unmarried men.

In the second study we show that both the early-career gender earnings gap and its subsequent growth with age are only partly related to the different career choices of men and women. It is true that women tend to work in lower paying sectors such as retail and services, and within most business sectors women are disproportionately found in the lower paying occupations. Careers in many of these female-dominated occupations already begin with somewhat lower pay than in the more male-dominated occupations, but, much more importantly, the growth potential of earnings over time turns out to be very different. Despite all this, sector and industry jointly explain only about a third of the widening of the gender earnings gap that occurs over time.

The magnitude and growth of the gender earnings gap look quite distinct from one sector to the next. By the apex of a person’s career, the largest gender gaps for the college educated can be found in the health, legal, and financial sectors (including insurance and real estate). Conversely, the widening of the gender earnings gap with age remains more modest in the tech sector. Earlier analyses by Claudia Goldin point to differences in schedule flexibility – specifically, the amount of client interaction and “face time” required — may explain why such pay gaps are more prevalent in some sectors than others and why they surface more when women have inflexible caregiver responsibilities.

Wage gap dynamics are less pronounced for high school graduates without a college degree. Here, too, the gender earnings gap widens with age, but almost all of the divergence in pay happens during the first five years after high school when men’s earnings grow particularly rapidly. After that, the earnings gap remains stagnant around 30%. For high-school dropouts, the gender pay gap does not increase but instead remains constant at 30%.

Notably, this relatively more equal performance of women in the no-college degree group mainly reflects the lack of growth in less-educated men’s earnings over the last few decades. Climbing the career ladder more quickly within a firm plays no role for employees in this group. The small, early-career divergence between men and women’s earnings among high school graduates is fully explained by men moving to better-paying firms in the initial years of their careers.

In future research, we plan to use this data set to focus on the presence of children to better understand the earnings trajectories of married college educated women, the role of the motherhood penalty, and different impacts of family migration on the earnings of men and women. What happens within the household is closely connected to what happens in the workplace, and our data offer a unique ability to look at that intersection for a very large number of families and firms.