Background Women are at high risk for painful colonoscopy. Pain, but also sedation, are barriers to colorectal cancer (CRC) screening participation. In a randomised controlled trial, we compared on-demand with pre-colonoscopy opioid administration to control pain in women at CRC screening age. Methods Women, aged 55-79 years, attending colonoscopy at two Norwegian endoscopy units were randomised 1:1:1 to (1) fentanyl on-demand, (2) fentanyl prior to colonoscopy, or (3) alfentanil on-demand. The primary endpoint was procedural pain reported by the patients on a validated four-point Likert scale and further dichotomized for the study into painful (moderate or severe pain) and non-painful (slight or no pain) colonoscopy. Secondary endpoints were: willingness to repeat colonoscopy, adverse events, cecal intubation time and rate, and post-procedure recovery time. Results Between June 2017 and May 2020, 183 patients were included in intention-to-treat analyses in the fentanyl on-demand group, 177 in the fentanyl prior to colonoscopy group, and 179 in the alfentanil on-demand group. Fewer women receiving fentanyl prior to colonoscopy reported a painful colonoscopy compared to those who were given fentanyl on-demand (25.2% vs. 44.1%, p < .001). There was no difference in the proportion of painful colonoscopies between fentanyl on-demand and alfentanil on-demand (44.1% vs. 39.5%, p = .40). No differences were observed for adverse events or any of the other secondary endpoints between the three groups. Conclusions Fentanyl prior to colonoscopy provided better pain control than fentanyl or alfentanil on-demand. Fentanyl before colonoscopy should be recommended to all women at screening age.