Reimbursement of hospitals by Medicare under the prospective-payment system is based on patients' diagnoses as coded at discharge. During the period October 1984 through March 1985, we studied the accuracy of the coding for diagnosis-related groups (DRGs) in hospitals receiving Medicare reimbursement. We used a two-stage cluster method to sample 7050 medical records from 239 hospitals that were stratified according to size. Using blinded techniques with reliability checks, medical-record specialists reabstracted the International Classification of Diseases, Ninth Revision, Clinical Modification (ICD-9-CM) codes to assign correct DRGs to discharged patients. The correct DRGs were then compared with those originally assigned by the physician and the hospital administration. The study revealed an error rate of 20.8 percent in DRG coding. Errors were distributed equally between physicians and hospitals. Small hospitals had significantly higher error rates. Previous studies had found that errors occurred randomly, so that half the errors benefited the hospital financially and half penalized the hospital. The present study found that a statistically significant 61.7 percent of coding errors favored the hospital. These errors caused the average hospital's case-mix index--a measure of the complexity of illness of the hospital's patients--to increase by 1.9 percent. As a result, hospitals received higher net reimbursement from Medicare than was supportable by the medical records. We conclude that "creep" does occur in the coding of DRGs, resulting in overpayment to hospitals for patients covered by Medicare.