IntroductionSurgical patients are commonly prescribed more opioids at discharge than needed to manage their postoperative pain. These excess opioids increase the risks of new persistent opioid use, opioid-induced ventilatory impairment and opioid diversion. This study tests the effectiveness of two behavioural nudges, one based on peer behaviour and one based on best practice guidelines, in reducing excessive postoperative opioid prescriptions.Methods and analysisThe study will be conducted at 19 hospitals within a large healthcare delivery system in northern California, USA. Three surgical specialties (general surgery, orthopaedic surgery and obstetric/gynaecological surgery) at each hospital will be randomised either to a control group or to one of two active intervention arms. One intervention is grounded in the theory of injunctive norms, and provides feedback to surgeons on their postoperative opioid prescribing relative to prescribing guidelines endorsed by their institution. The other intervention draws from the theory of descriptive norms, and provides feedback similar to the first intervention but using peers’ behaviour rather than guidelines as the benchmark for the surgeon’s prescribing behaviour. The interventions will be delivered by a monthly email. Both interventions will be active for twelve months. The effects of each intervention relative to the control group and to each other will be tested using a four-level hierarchical model adjusted for multiple hypothesis testing.Ethics and disseminationUsing behavioural nudges rather than rigid policy changes allows us to target excessive prescribing without preventing clinicians from using their clinical judgement to address patient pain. All study activities have been approved by the RAND Human Subjects Protection Committee (ID 2018-0988). Findings will be disseminated through conference presentations, peer-reviewed publications and social media accounts.Trial registration numberNCT05070338.