Objective: Our objective was to estimate the relative risk of IBD among first-generation and second-generation immigrants in Denmark compared with native Danes., Design: Using national registries, we established a cohort of Danish residents between 1977 and 2018. Cohort members with known country of birth were followed for Crohn's disease (CD) and ulcerative colitis (UC) diagnoses. Incidence rate ratios (IRRs) served as measures of relative risk and were calculated by log-linear Poisson regression, using rates among native Danes as reference, stratified by IBD risk in parental country of birth, and among first-generation immigrants by age at immigration and duration of stay in Denmark., Results: Among 8.7 million Danes, 4156 first-generation and 898 second-generation immigrants were diagnosed with CD or UC. Overall, comparing first-generation immigrants with native Danes, the IRR was 0.80 (95% CI 0.76 to 0.84) for CD and 0.74 (95% CI 0.71 to 0.77) for UC. The IRR of IBD increased with ≥20 years stay in Denmark. The IRR of CD increased with immigration at ≥40 years of age. Comparing second-generation immigrants with native Danes, the IRR of IBD was 0.97 (95% CI 0.91 to 1.04). There was significant interaction with sex, with higher IRR of IBD in male than in female immigrants., Conclusion: Relative to native Danish men and women, IBD risk among first-generation immigrants was lower, reflected the risk in their parental country of birth and increased with ≥20 years stay in Denmark. For second-generation immigrants, relative risk of IBD was lower only among women. These complex patterns suggest the role of environmental IBD risk factors., Competing Interests: Competing interests: MA receives intramural research support from the Dickler Family Fund. SS, a doctoral student at the Newbreed doctoral programme, receives funding from the European Union’s Horizon 2020 research and innovation programme under Marie Skłodowska-Curie Grant Agreement No 754285. J-FC reports receiving research grants from AbbVie, Janssen Pharmaceuticals and Takeda; receiving payment for lectures from AbbVie, Amgen, Allergan, Ferring Pharmaceuticals, Shire and Takeda; receiving consulting fees from AbbVie, Amgen, Arena Pharmaceuticals, Boehringer Ingelheim, Celgene Corporation, Celltrion, Eli Lilly, Enterome, Ferring Pharmaceuticals, Geneva, Genentech, Janssen Pharmaceuticals, Landos, Ipsen, Imedex, Medimmune, Merck, Novartis, O Mass, Otsuka, Pfizer, Shire, Takeda, Tigenix and Viela Bio; and hold stock options in Intestinal Biotech Development and Genfit., (© Author(s) (or their employer(s)) 2021. No commercial re-use. See rights and permissions. Published by BMJ.)