Objective: The association between thyroid disease and breast cancer risk remains unclear. We, therefore examined the association between hypothyroidism, hyperthyroidism and breast cancer risk. Design: This was a population-based cohort study. Methods: Using nationwide registries, we identified all women in Denmark with a first-time hospital diagnosis of hypothyroidism or hyperthyroidism, 1978-2013. We estimated the excess risk of breast cancer among patients with hypothyroidism or hyperthyroidism compared with the expected risk in the general population, using standardized incidence ratios (SIRs) as a measure of risk ratio. Breast cancer diagnoses in the first 12 months following diagnosis of thyroid disease were excluded from the calculations to avoid diagnostic work-up bias. Results: We included 61 873 women diagnosed with hypothyroidism and 80 343 women diagnosed with hyperthyroidism. Median follow-up time was 4.9 years (interquartile range (IQR): 1.8-9.5 years) for hypothyroidism and 7.4 years (IQR: 3.1-13.5 years) for hyperthyroidism. Hyperthyroidism was associated with a slightly increased breast cancer risk compared with the general population (SIR: 1.11, 95% CI: 1.07-1.16), which persisted beyond 5 years of follow-up (SIR: 1.13, 95% CI: 1.08-1.19). In comparison, hypothyroidism was associated with a slightly lower risk of breast cancer (SIR: 0.94, 95% CI: 0.88-1.00). Stratification by cancer stage at diagnosis, estrogen receptor status, age, comorbidity, history of alcohol-related disease and clinical diagnoses of obesity produced little change in cancer risk. Conclusions: We found an increased risk of breast cancer in women with hyperthyroidism and a slightly decreased risk in women with hypothyroidism indicating an association between thyroid function level and breast cancer risk.