It is thought that a reduction in the frequency of basal insulin injections might facilitate treatment acceptance and adherence among patients with type 2 diabetes. Insulin icodec is a basal insulin analogue designed for once-weekly administration that is in development for the treatment of diabetes.We conducted a 26-week, randomized, double-blind, double-dummy, phase 2 trial to investigate the efficacy and safety of once-weekly insulin icodec as compared with once-daily insulin glargine U100 in patients who had not previously received long-term insulin treatment and whose type 2 diabetes was inadequately controlled (glycated hemoglobin level, 7.0 to 9.5%) while taking metformin with or without a dipeptidyl peptidase 4 inhibitor. The primary end point was the change in glycated hemoglobin level from baseline to week 26. Safety end points, including episodes of hypoglycemia and insulin-related adverse events, were also evaluated.A total of 247 participants were randomly assigned (1:1) to receive icodec or glargine. Baseline characteristics were similar in the two groups; the mean baseline glycated hemoglobin level was 8.09% in the icodec group and 7.96% in the glargine group. The estimated mean change from baseline in the glycated hemoglobin level was -1.33 percentage points in the icodec group and -1.15 percentage points in the glargine group, to estimated means of 6.69% and 6.87%, respectively, at week 26; the estimated between-group difference in the change from baseline was -0.18 percentage points (95% CI, -0.38 to 0.02, P = 0.08). The observed rates of hypoglycemia with severity of level 2 (blood glucose level, <54 mg per deciliter) or level 3 (severe cognitive impairment) were low (icodec group, 0.53 events per patient-year; glargine group, 0.46 events per patient-year; estimated rate ratio, 1.09; 95% CI, 0.45 to 2.65). There was no between-group difference in insulin-related key adverse events, and rates of hypersensitivity and injection-site reactions were low. Most adverse events were mild, and no serious events were deemed to be related to the trial medications.Once-weekly treatment with insulin icodec had glucose-lowering efficacy and a safety profile similar to those of once-daily insulin glargine U100 in patients with type 2 diabetes. (Funded by Novo Nordisk; NN1436-4383 ClinicalTrials.gov number, NCT03751657.).