Summary Background Acute pyelonephritis is a common infection in adult women, but there is a paucity of controlled trials of its treatment and the optimum duration of antibiotic treatment has not been properly defined. We compared the efficacy of ciprofloxacin for 7 days and 14 days in women with community-acquired acute pyelonephritis. Methods In a prospective, non-inferiority trial undertaken at 21 centres of infectious diseases in Sweden, women (aged ≥18 years) who were not pregnant and had a presumptive diagnosis of acute pyelonephritis were randomly assigned to oral treatment with ciprofloxacin 500 mg twice daily for 7 days or 14 days. The first week was open label. A computer-generated randomisation list in block sizes of two was used for treatment allocation in a 1:1 ratio. The study was double-blind and placebo-controlled during the second week of treatment, which was either continuation of ciprofloxacin 500 mg or placebo tablets twice daily according to the randomisation code. Patients, carers, site investigators, and trial coordinating centre staff were masked to group assignment. The primary endpoint was the clinical and bacteriological outcome 10–14 days after completion of treatment with active drug. Analysis was by per protocol. This trial is registered with EudraCT, number 2005-004992-39, and ClinicalTrials.gov, number ISRCTN73338924. Findings 126 of 248 patients were randomly assigned to 7 days and 122 to 14 days of ciprofloxacin. 73 and 83 patients, respectively, were analysed. Short-term clinical cure occurred in 71 (97%) patients treated with ciprofloxacin for 7 days and 80 (96%) treated for 14 days (difference −0·9%; 90% CI −6·5 to 4·8; p=0·004; non-inferiority test). Cumulative efficacy at long-term follow-up was 93% in each group (68 of 73 vs 78 of 84; −0·3%; −7·4 to 7·2; p=0·015). Both regimens were well tolerated. Two patients discontinued ciprofloxacin because of myalgia with 7 days of treatment and itching exanthema with 14 days. Four (5%) of 86 patients assigned to 7 days of treatment who complied with study criteria and six (6%) of 93 assigned to 14 days reported an adverse event after the first week of treatment that was possibly or probably related to the study drug. In those assigned to 7 days, no patient had mucosal candida infection after the first week versus five treated for 14 days (p=0·036). Interpretation Our results show that acute pyelonephritis in women, including older women and those with a more severe infection, can be treated successfully and safely with oral ciprofloxacin for 7 days. Short courses of antibiotics should be favoured in an era of increasing resistance. Funding Swedish Strategic Programme against Antibiotic Resistance (Strama).