Surgical patients are vulnerable to opioid dependency and related risks. Clinical-translational data suggest that caffeine may enhance postoperative analgesia. This trial tested the hypothesis that intraoperative caffeine would reduce postoperative opioid consumption. The secondary objective was to assess whether caffeine improves neuropsychological recovery postoperatively. This was a single-center, randomized, placebo-controlled trial. Participants, clinicians, research teams, and data analysts were all blinded to the intervention. Adult (≥18 years old) surgical patients (n = 65) presenting for laparoscopic colorectal and gastrointestinal surgery were randomized to an intravenous caffeine citrate infusion (200 mg) or dextrose 5% in water (40 mL) during surgical closure. The primary outcome was cumulative opioid consumption through postoperative day 3. Secondary outcomes included subjective pain reporting, observer-reported pain, delirium, Trail Making Test performance, depression and anxiety screens, and affect scores. Adverse events were reported, and hemodynamic profiles were also compared between the groups. Sixty patients were included in the final analysis, with 30 randomized to each group. The median (interquartile range) cumulative opioid consumption (oral morphine equivalents, milligrams) was 77 mg (33-182 mg) for caffeine and 51 mg (15-117 mg) for placebo (estimated difference, 55 mg; 95% confidence interval [CI], -9 to 118; P = .092). After post hoc adjustment for baseline imbalances, caffeine was associated with increased opioid consumption (87 mg; 95% CI, 26-148; P = .005). There were otherwise no differences in prespecified pain or neuropsychological outcomes between the groups. No major adverse events were reported in relation to caffeine, and no major hemodynamic perturbations were observed with caffeine administration. Caffeine appears unlikely to reduce early postoperative opioid consumption. Caffeine otherwise appears well tolerated during anesthetic emergence.