Objectives: To determine the profile of risk of upper gastrointestinal toxicity during continuous treatment with, and after cessation of, non-steroidal anti-inflammatory drugs. Design: Cohort study with a prospectively constructed, population based, record linkage database containing details of exposure to all community dispensed non-steroidal anti-inflammatory drugs and also all admissions to hospital for upper gastrointestinal diagnoses. Setting: The population of Tayside, Scotland. Subjects: 52,293 subjects aged 50 and over who received one or more non-steroidal anti-inflammatory between 1 January 1989 and 31 December 1991 and 73,792 subjects who did not receive one during the same period (controls). Main outcome measures: Admission to hospital for upper gastrointestinal bleeding and perforation, and admission for other upper gastrointestinal diagnoses. Results: About 2% of the non-steroidal anti-inflammatory cohort were admitted with an upper gastrointestinal event during the study period compared with 1.4% of controls. The risk of admission for upper gastrointestinal haemorrhage and perforation was constant during continuous non-steroidal anti-inflammatory exposure and carried over after the end of exposure. The results were similar for admissions for all upper gastrointestinal events. Conclusion: This study provides evidence that non-steroidal anti-inflammatory toxicity persists with continuous exposure. There seems to be carryover toxicity after the end of prescribing. These findings have implications for the management of patients requiring non-steroidal anti-inflammatory drugs.