We conducted a two-sample Mendelian randomisation study to investigate the causal associations of type 2 diabetes mellitus (T2DM) with risk of overall cancer and 22 site-specific cancers. Summary-level data for cancer were extracted from the Breast Cancer Association Consortium and UK Biobank. Genetic predisposition to T2DM was associated with higher odds of pancreatic, kidney, uterine and cervical cancer, lower odds of oesophageal cancer and melanoma, but not associated with 16 other site-specific cancers or overall cancer. The odds ratios (95% confidence interval) were 1.13 (1.04, 1.22), 1.08 (1.00, 1.17), 1.08 (1.01, 1.15), 1.07 (1.01, 1.15), 0.89 (0.81, 0.98), and 0.93 (0.89, 0.97) for pancreatic, kidney, uterine, cervical, and oesophageal cancer and melanoma, respectively. The association between T2DM and pancreatic cancer was also observed in a meta-analysis of this and a previous Mendelian randomisation study (odds ratio 1.08; 1.02, 1.14; p=0.009). There was limited evidence supporting causal associations between fasting glucose and cancer. Genetically predicted fasting insulin levels were positively associated with cancers of the uterus, kidney, pancreas and lung. The present study found causal detrimental effects of T2DM on several cancers. We suggested to reinforce the cancers screening in T2DM patients to enable the early detection of cancer.