Using linked employer-employee data, this study measures and decomposes the differences in the earnings distribution between male and female employees in Germany. I extend the traditional decomposition to disentangle the effect of human capital characteristics and the effect of firm characteristics in explaining the gender wage gap. Furthermore, I implement the decomposition across the whole wage distribution with the method proposed by Machado and Mata (2005). Thereby, I take into account the dependence between the human capital endowment of individuals and workplace characteristics. The selection of women into less successful and productive firms explains a sizeable part of the gap. This selection is more pronounced in the lower part of the wage distribution than in the upper tail. In addition, women also benefit from the success of firms by rent-sharing to a lesser extent than their male colleagues. This is the source of the largest part of the pay gap. Gender differences in human capital endowment as well as differences in returns to human capital are less responsible for the wage differential.