We study the extent to which employer heterogeneity affects gender gaps in earnings across the distribution, over time, and over the life cycle, accounting for cohort effects. Using a linked employer-employee dataset for Italy, we show that the gender gap in firm pay premia explains 34% of the mean gender pay gap, mainly due to between-firm components. Within-firm differences are more important at the top of the distribution and have become more relevant over time. Gender differences in mobility toward firms with higher pay premia and within-firm gender inequality partly explain the gender gap in firm pay premia.