Background and purpose — Dislocation of total hip arthroplasties (THA) is often treated with closed reduction and traditionally not registered in orthopedic registers. This study aimed to create an algorithm designed to identify cases of dislocations of THAs with high sensitivity, specificity, and positive predictive value (PPV) based on codes from the Danish National Patient Register (DNPR). Patients and methods — All patients (n = 31,762) with primary osteoarthritis undergoing THA from January 1, 2010 to December 31, 2014 were included from the Danish Hip Arthroplasty Register (DHR). We extracted available data for every hospital contact in the DNPR during a 2-year follow-up period, then conducted a comprehensive nationwide review of 5,096 patient files to register all dislocations and applied codes. Results — We identified 1,890 hip dislocations among 1,094 of the included 31,762 THAs. More than 70 different diagnoses and 55 procedural codes were coupled to the hospital contacts with dislocation. A combination of the correct codes produced a sensitivity of 63% and a PPV of 98%. Adding alternative and often applied codes increased the sensitivity to 91%, while the PPV was maintained at 93%. Additional steps increased sensitivity to 95% but at the expense of an unacceptable decrease in the PPV to 82%. Specificity was, in all steps, greater than 99%. Interpretation — The developed algorithm achieved high and acceptable values for sensitivity, specificity, and predictive values. We found that surgeons in most cases coded correctly. However, the codes were not always transferred to the discharge summary. In perspective, this kind of algorithm may be used in Danish quality registers.