Background and objective: Data on the effectiveness of cyclooxygenase 2 inhibitors in postoperative pain therapy vary widely. We tested in a prospective, placebo-controlled, randomized, double-blind trial the hypotheses that perioperative (i.e. preoperative and postoperative) administration of the cyclooxygenase 2 inhibitor rofecoxib decreases pain scores and morphine consumption after spine, breast and orthopaedic surgery. Methods: Five hundred and forty patients scheduled for spine, breast or orthopaedic surgery were randomly assigned to receive in combination with postoperative morphine via patient controlled analgesia pump for 4 days either rofecoxib 50 mg administered perioperatively, rofecoxib 50 mg administered only postoperatively, or placebo. Primary outcome criteria were pain score at rest (numeric rating scale 0–4) and morphine consumption. Results: Perioperative rofecoxib significantly decreased pain score 0 (0–1) vs. 1 (0–2) (median (interquartile range)), and morphine consumption 18 (6–33) vs. 22.5 (12–38) compared with placebo. In contrast, rofecoxib when administered only postoperatively did not significantly improve analgesic effects or side-effects at time of assessment of the main criteria (24 h after skin closure), but during the follow-up period at 48 h and 72 h after skin closure pain scores and morphine consumption were improved compared to placebo. The analgesic effects of rofecoxib were independent from the type of surgery. Conclusions: Perioperative administration of the cyclooxygenase 2 inhibitor rofecoxib decreases pain scores and morphine consumption after orthopaedic, breast and spine surgery. However, the benefit of preoperative administration of the cyclooxygenase 2 inhibitor seems to be only moderate, suggesting that early postoperative administration may be a useful alternative approach. There is no evidence that the type of surgery influences analgesic effects of cyclooxygenase 2 inhibitors.