Exposure to non-steroidal anti-inflammatory drugs (NSAIDs) is known to increase substantially the risk of upper gastrointestinal bleeding and perforation (UGIB). We have carried out a population-based retrospective case-control study to assess the variation in risk associated with various individual NSAIDs, with adjustment for features of use and other independent risk factors. The study sample comprised 1457 cases of UGIB and 10,000 control subjects identified from general practitioners' computerised records in the UK. The adjusted estimate of relative risk of UGIB associated with current NSAID use was 4.7 (95% CI 3.8-5.7). Previous UGIB was the single most important predictor of UGIB (relative risk 13.5 [10.3-17.7]). For all NSAIDs together, the risk was greater for high doses than for low doses (7.0 [5.2-9.6] vs 2.6 [1.8-3.8]). The estimates of risk associated with the individual NSAIDs varied widely. Users of azapropazone (23.4 [6.9-79.5]) and piroxicam (18.0 [8.2-39.6]) had the highest risk of UGIB among the NSAIDs studied. All the other NSAIDs with sufficient data for individual analysis (ibuprofen, naproxen, diclofenac, ketoprofen, and indomethacin) had relative risks similar to that for overall NSAID use. NSAIDS should be used cautiously in patients who have other risk factors for UGIB; these include advanced age, smoking, history of peptic ulcer, and use of oral corticosteroids or anticoagulants.