Raised risks of several cancers have been found in patients with type II diabetes, but there are few data on cancer risk in type I diabetes. We conducted a cohort study of 28 900 UK patients with insulin-treated diabetes followed for 520 517 person-years, and compared their cancer incidence and mortality with national expectations. To analyse by diabetes type, we examined risks separately in 23 834 patients diagnosed with diabetes under the age of 30 years, who will almost all have had type I diabetes, and 5066 patients diagnosed at ages 30-49 years, who probably mainly had type II. Relative risks of cancer overall were close to unity, but ovarian cancer risk was highly significantly raised in patients with diabetes diagnosed under age 30 years (standardised incidence ratio (SIR)=2.14; 95% confidence interval (CI) 1.22-3.48; standardised mortality ratio (SMR)=2.90; 95% CI 1.45-5.19), with greatest risks for those with diabetes diagnosed at ages 10-19 years. Risks of cancer at other major sites were not substantially raised for type I patients. The excesses of obesity- and alcohol-related cancers in type II diabetes may be due to confounding rather than diabetes per se.