We use a massive, matched employer-employee database for the United States to analyze the contribution of firms to the rise in earnings inequality from 1978 to 2013. We ﬁnd that one-third of the rise in the variance of (log) earnings occurred within firms, whereas two-thirds of the rise occurred between firms. However, this rising between-firm variance is not accounted for by the firms themselves: the firm-related rise in the variance can be decomposed into two roughly equally important forces—a rise in the sorting of high-wage workers to high-wage firms and a rise in the segregation of similar workers between firms. In contrast, we do not ﬁnd a rise in the variance of firm-speciﬁc pay once we control for worker composition. Instead, we see a substantial rise in dispersion of person-speciﬁc pay, accounting for 68% of rising inequality, potentially due to rising returns to skill. The rise in between-firm variance, mostly due to worker sorting and segregation, accounted for a particularly large share of the total increase in inequality in smaller and medium firms (explaining 84% for firms with fewer than 10,000 employees). In contrast, in the very largest firms with 10,000+ employees, 42% of the increase in the variance of earnings took place within firms, driven by both declines in earnings for employees below the median and a substantial rise in earnings for the 10% best-paid employees. However, because of their small number, the contribution of the very top 50 or so earners at large firms to the overall increase in within-firm earnings inequality is small.