Background and purpose: The risk of complications in cirrhosis patients after orthopedic surgery is unclear. We examined this risk after total hip arthroplasty (THA) or total knee arthroplasty (TKA). Patients and methods: Using Danish healthcare registries, we identified all Danish residents who underwent a THA or TKA for primary osteoarthritis in the period 1995-2011. We compared the risk of complications in patients with or without cirrhosis. Results: The surgical technique was similar in the 363 cirrhosis patients and in 109,159 reference patients, but cirrhosis patients were more likely to have been under general anesthesia (34% vs. 23%), were younger (median age 66 vs. 69 years), had a predominance of males (54% vs. 41%), had more comorbidity, and had had more hospitalizations preoperatively. Their risk of intraoperative complications was similar to that for reference patients (2.5% vs. 2.0%), but they had greater risk of dying during hospitalization or within 30 days of discharge (1.4% vs. 0.4%; aOR = 3.9, 95% CI: 1.5-10); greater risk of postoperative transfer to an intensive care unit (0.6% vs. 0.06%; aOR = 5.8, CI: 1.3-25) or a medical department (4.4% vs. 2.5%; aOR = 1.7, CI: 0.99-2.9); greater risk of readmission within 30 days of discharge (15% vs. 8%; aOR = 1.8, CI: 1.3-2.4); and greater risk of deep prosthetic infection (3.1% vs. 1.4%) or revision (3.7% vs. 1.7%) within 1 year. The chance of having an uncomplicated procedure was 81.0% (CI: 76.6-85.0) for cirrhosis patients and 90.0% (CI: 89.6-90.0) for reference patients. Interpretation: Cirrhosis patients had a higher risk of postoperative complications after THA or TKA for primary osteoarthritis than patients without cirrhosis. This may have implications for orthopedic surgeons' postoperative management of cirrhosis patients, and preoperative assessment by a hepatologist may be indicated.