To identify risk factors for Clostridium difficile infection (CDI) in Danish patients consulting general practice with gastrointestinal symptoms, a prospective matched case-control study was performed; cases (N = 259) had positive cultures for toxigenic C. difficile and controls (N = 455) negative cultures. Data were analysed by conditional logistic regression. In patients aged ⩾2 years (138 cases), hospitalization [odds ratio (OR) 8·4, 95% confidence interval (CI) 3·1–23], consumption of beef (OR 5·5, 95% CI 2·0–15), phenoxymethylpenicillin (OR 15, 95% CI 2·7–82), dicloxacillin (OR 27, 95% CI 3·6–211), and extended spectrum penicillins (OR 9·2, 95% CI 1·9–45) were associated with CDI. In patients aged <2 years none of these were associated with CDI, but in a subgroup analysis contact with animals was associated with CDI (OR 8·1, 95% CI 1·0–64). This study emphasizes narrow-spectrum penicillins, and suggests beef consumption, as risk factors for CDI in adults, and indicates a different epidemiology of CDI in infants.