Epidemiological studies consistently show that circulating sex hormone binding globulin (SHBG) levels are lower in type 2 diabetes patients than non-diabetic individuals, but the causal nature of this association is controversial. Genetic studies can help dissect causal directions of epidemiological associations because genotypes are much less likely to be confounded, biased or influenced by disease processes. Using this Mendelian randomization principle, we selected a common single nucleotide polymorphism (SNP) near the SHBG gene, rs1799941, that is strongly associated with SHBG levels. We used data from this SNP, or closely correlated SNPs, in 27 657 type 2 diabetes patients and 58 481 controls from 15 studies. We then used data from additional studies to estimate the difference in SHBG levels between type 2 diabetes patients and controls. The SHBG SNP rs1799941 was associated with type 2 diabetes [odds ratio (OR) 0.94, 95% CI: 0.91, 0.97; P = 2 × 10−5], with the SHBG raising allele associated with reduced risk of type 2 diabetes. This effect was very similar to that expected (OR 0.92, 95% CI: 0.88, 0.96), given the SHBG-SNP versus SHBG levels association (SHBG levels are 0.2 standard deviations higher per copy of the A allele) and the SHBG levels versus type 2 diabetes association (SHBG levels are 0.23 standard deviations lower in type 2 diabetic patients compared to controls). Results were very similar in men and women. There was no evidence that this variant is associated with diabetes-related intermediate traits, including several measures of insulin secretion and resistance. Our results, together with those from another recent genetic study, strengthen evidence that SHBG and sex hormones are involved in the aetiology of type 2 diabetes.