Background Warfarin, a vitamin K antagonist, has been shown to affect bone mineral density and cause osteoporosis. However, studies investigating the relationship between non-vitamin K antagonist oral anticoagulants (NOACs) and osteoporosis are limited. We thus compared the risk of osteoporosis in patients with atrial fibrillation treated with either NOACs or warfarin. Methods and Results This nationwide, retrospective cohort study used Taiwan's National Health Insurance Research Database. All adult patients in Taiwan who were newly diagnosed with atrial fibrillation and treated with NOACs or warfarin between January 2012 and December 2015 were included and classified into their respective cohorts. Patients who received NOACs were subcategorized into the rivaroxaban, dabigatran, and apixaban subgroups. Propensity score matching was performed for each head-to-head comparison. Adjusted hazard ratios (aHRs) for the risk of osteoporosis were calculated using Cox proportional hazards regression models, with adjustment for confounders. Overall, 17 008 patients were included, with 8504 in each cohort. NOACs were associated with a lower osteoporosis risk than warfarin (aHR=0.82; 95% CI=0.68-0.97). A subgroup effect of treatment duration was identified (namely, the lower osteoporosis risk with NOAC compared with warfarin became stronger in those with longer treatment duration [P for interaction <0.001]). Furthermore, significantly lower risks of osteoporosis were observed in the rivaroxaban (aHR=0.68; 95% CI=0.55-0.83) and apixaban (aHR=0.38; 95% CI=0.22-0.66) subgroups, but not in the dabigatran subgroup (aHR=1.04; 95% CI=0.85-1.27). Conclusions Compared with warfarin, rivaroxaban and apixaban were associated with a significantly lower risk of osteoporosis in patients with atrial fibrillation.