Objective To compare the use of glyburide and insulin in the treatment of gestational diabetes. Design Randomized controlled trial. Setting Maternal health clinics in San Antonio, Texas. Patients Women with mild gestational diabetes (n = 404) at 11-33 weeks gestation. Only women with a singleton pregnancy were eligible. Intervention Glyburide (starting dose 2.5 mg, increased as necessary to achieve target glycaemic control to a maximum of 20 mg) or insulin (0.7 U per kg body weight, three times daily, increased as necessary). If blood glucose goals were not met after 2 weeks of treatment with the maximal dose of glyburide, treatment was switched to insulin. Main outcome measures Primary outcome was achievement of a desirable level of glycaemic control (strict target ranges were set for mean, fasting, preprandial and postprandial blood glucose, measured by frequent home monitoring). Neonatal outcomes were also assessed. Main results Eighty-two percent of women in the glyburide group and 88% of women in the insulin group achieved the target blood glucose values (difference =-6%, 95% confidence interval (CI) -13% to +1%, P = 0.07). Considerably less women in the glyburide group had blood glucose values below 40 mg (2.2 mmol/l) per decilitre (2% vs. 20%, difference -18%, 95% CI -24% to -13%, P < 0.0001). In the glyburide group, 4% of women were switched to insulin as the maximal dose failed to produce target blood glucose values. There were no significant differences in neonatal outcomes, including cord serum insulin. Conclusion Treatment of women with gestational diabetes, after the first trimester of pregnancy, with glyburide rather than insulin can achieve similar glycaemic control, with less hypoglycaemia.