We aimed to assess differences in the prevalence of hepatitis B virus (HBV) infection in The Netherlands between 1996 and 2007, and to identify risk factors for HBV infection in 2007. Representative samples of the Dutch population in 1996 and 2007 were tested for antibodies to hepatitis B core antigen (anti-HBc), hepatitis B surface antigen (HBsAg) and HBV-DNA. In 2007, the weighted anti-HBc prevalence was 3·5% (95% CI 2·2–5·5) and the HBsAg prevalence was 0·2% (95% CI 0·1–0·4). In indigenous Dutch participants, the anti-HBc prevalence was lower in 2007 than in 1996 (P=0·06). First-generation migrants (FGMs) had a 13-fold greater risk of being HBsAg- and/or HBV-DNA-positive than indigenous Dutch participants. In indigenous Dutch participants, risk factors for anti-HBc positivity were older age and having received a blood product before 1990. In FGMs, being of Asian origin was a risk factor. In second-generation migrants, having a foreign-born partner and injecting drug use were risk factors. FGMs are the main target group for secondary HBV prevention in The Netherlands.