The aim of this study was to investigate the prevalence of extended-spectrum beta-lactamase (ESBL)-producing bacteria in patients at various hospital wards and in a group of relatively healthy volunteers, in order to obtain greater knowledge on how common these bacterial strains are in hospital settings and in the general community. Participants (n = 427) were enrolled at a University Hospital and at Primary Health Care Units (PHCUs) in Sweden in 2008 and 2010. The participants provided rectal swabs, which were tested for the occurrence of ESBL-producing bacteria. Positive samples were analysed with polymerase chain reaction (PCR) methods for bacterial strain typing and ESBL phylogroups. In 2008, the prevalence was 2.1% (2/96) in PHCU subjects and 1.8% (2/113) in hospital patients. In 2010, the prevalence was 3.0% (3/100) in PHCU subjects and 6.8% (8/118) in hospital patients. The dominating phylogroups were CTX-M-1 and CTX-M-9. All ESBL-positive isolates were Escherichia coli. We found a higher prevalence of ESBL faecal carriage than expected, both in the hospital setting and in the PHCU group.