The age-standardised incidence ratio of gastrointestinal cancers in type 1 diabetes (T1D) patients has been reported to be higher than that in the general population. After adjusting for shared risk factors, we aimed to explore the association between T1D and gastrointestinal cancer and examine how this relationship varies by age and sex. This retrospective cohort study included 268,179 participants from the Korean National Health Insurance Service-National Sample Cohort. The primary outcome is the incident of gastrointestinal cancers, based on diagnostic codes. Multivariate Cox regression analyses were performed to assess the association between T1D and gastrointestinal cancers. Of the 268,179 participants, 2681 had T1D at baseline and were followed for 12.98 (± 2.92) years. Compared with non-T1D, T1D patients had a significantly increased risk of all gastrointestinal cancer (adjusted hazard ratio [aHR]: 1.403, 95% confidence interval [CI]: 1.253-1.573). T1D patients increased risks of oesophageal cancer (aHR: 1.864, 95% CI: 1.038-3.349), gastric cancer (aHR: 1.313, 95% CI: 1.066-1.616), colon cancer (aHR: 1.365, 95% CI: 1.110-1.678), liver cancer (aHR: 1.388, 95% CI: 1.115-1.727), and pancreatic cancer (aHR: 1.716, 95% CI: 1.182-2.492). The consistency of this association persisted among both male and female, with its strength increasing with older age. The risk of gastrointestinal cancer was significantly increased in T1D patients. Older male T1D patients exhibit a higher risk, suggesting the need for targeted attention in their care.