Primary sclerosing cholangitis (PSC) is a rare progressive disorder leading to bile duct destruction; ∼75% of patients have comorbid inflammatory bowel disease (IBD). We undertook the largest genome-wide association study of PSC (4,796 cases and 19,955 population controls) and identified four new genome-wide significant loci. The most associated SNP at one locus affects splicing and expression of UBASH3A, with the protective allele (C) predicted to cause nonstop-mediated mRNA decay and lower expression of UBASH3A. Further analyses based on common variants suggested that the genome-wide genetic correlation (rG) between PSC and ulcerative colitis (UC) (rG = 0.29) was significantly greater than that between PSC and Crohn's disease (CD) (rG = 0.04) (P = 2.55 × 10-15). UC and CD were genetically more similar to each other (rG = 0.56) than either was to PSC (P < 1.0 × 10-15). Our study represents a substantial advance in understanding of the genetics of PSC.