A retrospective cohort study determined the risk and cost of gastrointestinal side effects associated with the use of nonsteroidal anti-inflammatory drugs for an at-risk period from January 1, 1985, through March 31, 1985. Overall relative risk, adjusted for sex and race, was 2.52 (95% confidence interval, 2.25 to 2.82) and varied from 1.64 (95% confidence interval, 0.92 to 2.91) for duodenal ulcer to 3.27 (95% confidence interval, 1.40 to 7.66) for gastrointestinal bleeding. After deleting cases with a history of steroid or anticoagulant use or an alcohol-related diagnosis, adjusted relative risk was 2.58 (95% confidence interval, 2.29 to 2.90) and varied from 1.45 (95% confidence interval, 0.73 to 2.89) for all other cases of peptic ulcer to 2.37 (95% confidence interval, 1.26 to 4.46) for disorders of stomach function. There was a bimodal distribution of expenditures of Medicaid-paid gastrointestinal side effects. Most patients had low hospitalization costs, but an important minority had high hospitalization costs. Median ambulatory treatment costs during the 3-month study period for persons with gastrointestinal side effects was $27 and varied from $14 for those diagnosed as having nausea, vomiting, or heartburn to $393 for those diagnosed as having gastrointestinal bleeding. Median inpatient costs were $2006 and ranged from $1487 for persons with nausea, vomiting, or heartburn to $2486 for those with duodenal ulcer. For patients who had undergone an inpatient surgical procedure other than endoscopy alone, median hospital costs were $7209. An approximately twofold increase in payment for the same services would be expected if private third-party payers were responsible for the bill.