ABSTRACT: Data regarding the risk of gastrointestinal and extraintestinal cancers in Crohn's disease (CD) and ulcerative colitis (UC) are needed to understand the clinical course of inflammatory bowel diseases (IBDs) and their treatments.We performed a nationwide historical cohort study using Danish health care databases. We identified patients with a diagnosis of CD or UC, recorded from 1978 through 2010, and followed them up until the first occurrence of cancer, death, or emigration. We used standardized incidence ratios (SIRs) to compare cancer incidence in CD and UC patients with that expected in the general population.Excluding cancers diagnosed within 1 year of IBD diagnosis, 772 cases of invasive cancer occurred among 13,756 patients with CD (SIR, 1.3; 95% confidence interval [CI], 1.2-1.4) and 2331 occurred among 35,152 patients with UC (SIR, 1.1; 95% CI, 1.0-1.1). CD was associated weakly with gastrointestinal cancers (SIR, 1.2; 95% CI, 1.0-1.4) and extraintestinal cancers (SIR, 1.3; 95% CI, 1.2-1.4), with the strongest associations for hematologic malignancies (SIR, 1.9; 95% CI, 1.5-2.3), smoking-related cancers (SIR, 1.5; 95% CI, 1.3-1.8), and melanoma (SIR, 1.4; 95% CI, 1.0-1.9). Associations between UC and gastrointestinal and extraintestinal cancers were weaker (SIR, 1.1; 95% CI, 1.0-1.2; and SIR, 1.1; 95% CI, 1.0-1.1, respectively). The relative risk of extraintestinal cancers among patients with IBD was relatively stable over time, although the risk of gastrointestinal cancers decreased.Patients with IBD, particularly CD, are at increased risk for gastrointestinal and extraintestinal malignancies. The relative risk of gastrointestinal malignancy has decreased since 1978, without a concomitant increase in the risk of nongastrointestinal malignancy.