BackgroundThe prevalence of infections caused by extended-spectrum beta-lactamase producing Escherichia coli (ESBL-E. coli) is increasing worldwide, but the setting in which this increase is occurring is not well defined. We compared trends and risk factors for ESBL-E. coli bacteriuria in community vs healthcare settings.MethodsWe collected electronic health record data on all patients with E. coli isolated from urine cultures in a safety-net public healthcare system from January 2014 to March 2020. All analyses were stratified by healthcare-onset/associated (bacteriuria diagnosed > 48 hours after hospital admission or in an individual hospitalized in the past 90 days or in a skilled nursing facility resident, N=1,277) or community-onset bacteriuria (all other, N=7,751). We estimated marginal trends from logistic regressions to evaluate annual change in prevalence of ESBL-E. coli bacteriuria among all bacteriuria. We evaluated risk factors using logistic regression models.ResultsESBL-E. coli prevalence increased in both community-onset (0.91% per year, 95% CI: 0.56%, 1.26%) and healthcare-onset/associated (2.31% per year, CI: 1.01%, 3.62%) bacteriuria. In multivariate analyses, age >65 (RR 1.88, CI: 1.17, 3.05), male gender (RR 2.12, CI: 1.65, 2.73), and Latinx race/ethnicity (RR 1.52, CI: 0.99, 2.33) were associated with community-onset ESBL-E. coli. Only male gender (RR 1.53, CI: 1.03, 2.26) was associated with healthcare-onset/associated ESBL-E. coli.ConclusionsESBL-E. coli bacteriuria frequency increased at a faster rate in healthcare-associated settings than in the community between 2004 to 2020. Male gender was associated with ESBL-E. coli bacteriuria in both settings, but additional risks—age >65 and Latinx race/ethnicity—were observed only in the community.