Obesity is a risk factor for colorectal cancer. Yet, some research indicates that weight-reducing bariatric surgery also increases colorectal cancer risk. Our study was undertaken because current evidence examining bariatric surgery and risk of colorectal cancer is limited and inconsistent. This population-based cohort study included adults with a documented obesity diagnosis in Denmark, Finland, Iceland, Norway or Sweden in 1980–2015. The incidence of colorectal cancer in participants with obesity who had and had not undergone bariatric surgery was compared to the incidence in the corresponding background population by calculating standardized incidence ratios (SIR) with 95% confidence intervals (CI). Additionally, operated and nonoperated participants with obesity were compared using multivariable Cox regression, providing hazard ratios (HR) with 95% CIs adjusted for confounders. Among 502,772 cohort participants with an obesity diagnosis, 49,931(9.9%) underwent bariatric surgery. The overall SIR of colon cancer was increased after bariatric surgery (SIR 1.56; 95% CI 1.28–1.88), with higher SIRs ≥10 years postsurgery. The overall HR of colon cancer in operated compared to nonoperated participants was 1.13 (95% CI 0.92–1.39) and 1.55 (95% CI 1.04–2.31) 10–14 years after bariatric surgery. Bariatric surgery did not significantly increase the risk of rectal cancer (SIR 1.14, 95% CI 0.83–1.52; HR 1.08, 95% CI 0.79–1.49), but the risk estimates increased with longer follow-up periods. Our study suggests that bariatric surgery is associated with an increased risk of colon cancer, while the support for an increased risk of rectal cancer was weaker.