We performed a genome-wide meta-analysis of hypothyroidism (114,813 cases and 1,043,713 controls), free thyroxine (186,409 individuals) and thyroid stimulating hormone (459,999 individuals). We have identified 326 loci associated with hypothyroidism, including 156 that have not been previously reported, with 25 loci linked through thyroid hormones. We found that many of the hypothyroidism risk loci regulate levels of blood cell counts and the circulating inflammasome. Using evidence from orthogonal gene-mapping strategies, we prioritized 250 putative genes and observed gene enrichment in functions of the immune system. We also developed a hypothyroidism polygenic risk score (PRS) from over 111,000 cases to address diagnostic challenges in patients with or at risk of thyroid hormone deficiency. We found that the PRS markedly improved risk prediction beyond that of prevalent autoimmune diseases. Further, when we combined the PRS with thyroid peroxidase autoantibodies, we observed the highest predictive accuracy. Among individuals with subclinical hypothyroidism, the PRS identified individuals at higher risk of progressing to overt disease. Our findings demonstrate the clinical potential of using a PRS to predict disease progression and onset, offering a promising tool for early intervention strategies that could prevent long-term morbidity associated with thyroid hormone deficiency.