Carpal tunnel syndrome (CTS) is the most common entrapment neuropathy and has a largely unknown underlying biology. In a genome-wide association study of CTS (48,843 cases and 1,190,837 controls), we found 53 sequence variants at 50 loci associated with the syndrome. The most significant association is with a missense variant (p.Glu366Lys) in SERPINA1 that protects against CTS (P = 2.9 × 10-24, OR = 0.76). Through various functional analyses, we conclude that at least 22 genes mediate CTS risk and highlight the role of 19 CTS variants in the biology of the extracellular matrix. We show that the genetic component to the risk is higher in bilateral/recurrent/persistent cases than nonrecurrent/nonpersistent cases. Anthropometric traits including height and BMI are genetically correlated with CTS, in addition to early hormonal-replacement therapy, osteoarthritis, and restlessness. Our findings suggest that the components of the extracellular matrix play a key role in the pathogenesis of CTS.