Background and study aims: The effect on abdominal pain of using carbon dioxide (CO(2)) for insufflation during endoscopic retrograde cholangiopancreatography (ERCP) has not been investigated. The present study aimed to compare CO(2) insufflation with standard air insufflation with respect to the pain experienced during and after ERCP. In addition, we investigated the effect of CO(2) insufflation on the partial pressure of CO(2) (PCO(2)). Patients and methods: A total of 118 consecutive patients who were undergoing ERCP were randomized to CO(2) insufflation or to air insufflation during the procedure. Both the endoscopists and the patients were blinded with regard to the gas used. Patients rated the intensity of pain experienced on a 100-mm visual analogue scale (VAS) during ERCP and at 1 hour, 3 hours, 6 hours, and 24 hours after the procedure. Transdermal PCO(2) was measured continuously in all patients during the procedure. Results: Altogether, 116 patients were eligible for analysis, 58 in each treatment group, and 91 patients responded to the questionnaire (78%). The mean severity of postprocedure pain was significantly reduced in the CO(2) group compared with the air group at 1 hour (5 mm vs. 19 mm on the VAS, P < 0.001), at 3 hours (7 mm vs. 21 mm, P < 0.001), at 6 hours (10 mm vs. 22 mm, P = 0.006), and at 24 hours (4 mm vs. 20 mm, P < 0.001) after the procedure. Radiographs taken 5 minutes after the procedure showed that abdominal distension was more pronounced in patients in the air insufflation group. There were no differences in PCO(2) values between the two treatment groups. Conclusions: Carbon dioxide insufflation during ERCP significantly reduces postprocedural abdominal pain. No side effects were observed. Carbon dioxide should be the standard gas used for insufflation in ERCP.