We determined the efficacy and the minimum treatment time necessary for prophylaxis with nonsteroidal anti-inflammatory drugs (NSAIDs) for periarticular heterotopic ossification (HO) after total hip arthroplasty (THA). Using a double-blind placebo controlled design, 144 patients operated on with total hip arthroplasty for primary arthrosis were treated postoperatively with (1) ibuprofen for 3 weeks, (2) ibuprofen for 1 week and placebo for the next 2 weeks or (3) placebo for 3 weeks. Radiographic occurrence of periarticular heterotopic ossification and complications of the treatment were recorded for the first year. Both ibuprofen-treated groups showed significantly less HO than the placebo-treated group. There was no difference in HO between the patients treated for 8 or 21 days postoperatively. Both 8 and 21 days of treatment with ibuprofen following THA effectively prevents clinically significant degrees of HO. No serious short-term complications of the treatment were noted.