Here, we performed a pancancer association analysis of 147 alleles of HLA-class I/II genes (HLA-A, B, and C/DRB1, DQA1, DQB1, DPA1, and DPB1) in 31,727 cases of 12 cancer types, including 1684 liver cancer cases and 107,103 controls. Here, HLA-DPB1 is linked to cancer.