Background: Urogenital Chlamydia trachomatis infection remains prevalent and causes substantial reproductive morbidity. Recent studies have raised concern about the efficacy of azithromycin for the treatment of chlamydia infection. Methods: We conducted a randomized trial comparing oral azithromycin with doxycycline for the treatment of urogenital chlamydia infection among adolescents in youth correctional facilities, to evaluate the noninferiority of azithromycin (1 g in one dose) to doxycycline (100 mg twice daily for 7 days). The treatment was directly observed. The primary end point was treatment failure at 28 days after treatment initiation, with treatment failure determined on the basis of nucleic acid amplification testing, sexual history, and outer membrane protein A (OmpA) genotyping of C. trachomatis strains. Results: Among the 567 participants enrolled, 284 were randomly assigned to receive azithromycin, and 283 were randomly assigned to receive doxycycline. A total of 155 participants in each treatment group (65% male) made up the per-protocol population. There were no treatment failures in the doxycycline group. In the azithromycin group, treatment failure occurred in 5 participants (3.2%; 95% confidence interval, 0.4 to 7.4%). The observed difference in failure rates between the treatment groups was 3.2 percentage points, with an upper boundary of the 90% confidence interval of 5.9 percentage points, which exceeded the prespecified absolute 5-percentage-point cutoff for establishing the noninferiority of azithromycin. Conclusions: In the context of a closed population receiving directly observed treatment for urogenital chlamydia infection, the efficacy of azithromycin was 97%, and the efficacy of doxycycline was 100%. The noninferiority of azithromycin was not established in this setting.