Previous meta-analyses of summary data from randomised controlled trials have shown that statin therapy increases the risk of diabetes, but less is known about the size or timing of this effect, or who is at greatest risk. We aimed to address these gaps in knowledge through analysis of individual participant data from large, long-term, randomised, double-blind trials of statin therapy. We conducted a meta-analysis of individual participant data from randomised controlled trials of statin therapy that participated in the CTT Collaboration. All double-blind randomised controlled trials of statin therapy of at least 2 years' scheduled duration and with at least 1000 participants were eligible for inclusion in this meta-analysis. All recorded diabetes-related adverse events, treatments, and measures of glycaemia were sought from eligible trials. Meta-analyses assessed the effects of allocation to statin therapy on new-onset diabetes (defined by diabetes-related adverse events, use of new glucose-lowering medications, glucose concentrations, or HbA1c values) and on worsening glycaemia in people with diabetes (defined by complications of glucose control, increased use of glucose-lowering medication, or HbA1c increase of ≥0·5%). Standard inverse-variance-weighted meta-analyses of the effects on these outcomes were conducted according to a prespecified protocol. Of the trials participating in the CTT Collaboration, 19 trials compared statin versus placebo (123 940 participants, 25 701 [21%] with diabetes; median follow-up of 4·3 years), and four trials compared more versus less intensive statin therapy (30 724 participants, 5340 [17%] with diabetes, median follow-up of 4·9 years). Compared with placebo, allocation to low-intensity or moderate-intensity statin therapy resulted in a 10% proportional increase in new-onset diabetes (2420 of 39 179 participants assigned to receive a statin [1·3% per year] vs 2214 of 39 266 participants assigned to receive placebo [1·2% per year]; rate ratio [RR] 1·10, 95% CI 1·04-1·16), and allocation to high-intensity statin therapy resulted in a 36% proportional increase (1221 of 9935 participants assigned to receive a statin [4·8% per year] vs 905 of 9859 participants assigned to receive placebo [3·5% per year]; 1·36, 1·25-1·48). For each trial, the rate of new-onset diabetes among participants allocated to receive placebo depended mostly on the proportion of participants who had at least one follow-up HbA1c measurement; this proportion was much higher in the high-intensity than the low-intensity or moderate-intensity trials. Consequently, the main determinant of the magnitude of the absolute excesses in the two types of trial was the extent of HbA1c measurement rather than the proportional increase in risk associated with statin therapy. In participants without baseline diabetes, mean glucose increased by 0·04 mmol/L with both low-intensity or moderate-intensity (95% CI 0·03-0·05) and high-intensity statins (0·02-0·06), and mean HbA1c increased by 0·06% (0·00-0·12) with low-intensity or moderate-intensity statins and 0·08% (0·07-0·09) with high-intensity statins. Among those with a baseline measure of glycaemia, approximately 62% of new-onset diabetes cases were among participants who were already in the top quarter of the baseline distribution. The relative effects of statin therapy on new-onset diabetes were similar among different types of participants and over time. Among participants with baseline diabetes, the RRs for worsening glycaemia were 1·10 (1·06-1·14) for low-intensity or moderate-intensity statin therapy and 1·24 (1·06-1·44) for high-intensity statin therapy compared with placebo. Statins cause a moderate dose-dependent increase in new diagnoses of diabetes that is consistent with a small upwards shift in glycaemia, with the majority of new diagnoses of diabetes occurring in people with baseline glycaemic markers that are close to the diagnostic threshold for diabetes. Importantly, however, any theoretical adverse effects of statins on cardiovascular risk that might arise from these small increases in glycaemia (or, indeed, from any other mechanism) are already accounted for in the overall reduction in cardiovascular risk that is seen with statin therapy in these trials. These findings should further inform clinical guidelines regarding clinical management of people taking statin therapy. British Heart Foundation, UK Medical Research Council, and Australian National Health and Medical Research Council.