ABSTRACT: We aimed to evaluate the comparative efficacy and safety of drugs respectively for primary prevention and secondary prevention of osteoporotic fractures in postmenopausal women (PMW), and to further identify the optimal intervention(s) respectively for the two groups when efficacy and safety both considered. We searched three databases. Bayesian network meta-analyses were conducted for two efficacy outcomes (vertebral fractures and nonvertebral fractures) and two safety outcomes (tolerability and acceptability) respectively in primary prevention group and secondary prevention group. We synthesized hazard ratios (HRs) and 95% confidence intervals (CIs) for nonvertebral fractures, and risk ratios (RRs) for three others. Factor and cluster analyses on surface under the cumulative ranking curve (SUCRA) values were conducted to identify the best intervention(s) with efficacy and safety both considered. The study protocol has been registered in PROSPERO. We included 57 randomized trials involving fifteen anti-osteoporotic interventions and 106320 PMW. For primary prevention, only zoledronate (once per 18 months) reduced both vertebral (RR 0.46, 95% CI 0.28-0.74) and nonvertebral (HR 0.66, 95% CI 0.51-0.85) fractures. For secondary prevention, abaloparatide, alendronate, denosumab, lasofoxifene, risedronate, romosozumab, teriparatide, and zoledronate (once per 12 months) reduced both vertebral (RRs: from 0.17 to 0.62) and nonvertebral (HRs: from 0.54 to 0.81) fractures. PTH (1-84) and abaloparatide increased withdrawal risk. Romosozumab, teriparatide, denosumab and risedronate, with the greatest composite scores, constituted the optimal cluster having both superior efficacy and superior safety. Zoledronate used at 5 mg per 18 months, with the similar safety as placebo, is the only drug intervention which has been shown to significantly reduce both vertebral and nonvertebral fractures for primary prevention of osteoporotic fractures in PMW; while romosozumab, teriparatide, denosumab, and risedronate are the optimal treatments for secondary prevention when efficacy and safety both considered. A limitation is that safety outcomes failed to consider the severity of adverse effects.