We evaluated the association between typhoid fever and Helicobacter pylori infection, as the latter microorganism may influence gastric acid secretion and consequently increase susceptibility to Salmonella typhi infection. Anti-H. pylori IgG and IgA antibody titres (ELISA) and gastrin concentration (RIA) were determined in the plasma of 87 blood culture-confirmed typhoid fever cases (collected after clinical recovery) and 232 random healthy controls without a history of typhoid fever, in the Jatinegara district, Jakarta. Patients with typhoid fever more often than controls were seropositive for H. pylori IgG (67% vs. 50%, P<0·008), when antibody titres were dichotomized around median titres observed in controls. H. pylori IgA seropositivity was not associated with typhoid fever. Plasma gastrin concentrations indicative of hypochlorhydria (i.e. gastrin ⩾25 or ⩾100 ng/l) were not significantly elevated in typhoid fever cases compared to controls (P=0·54 and P=0·27 respectively). In a multivariate analysis, typhoid fever was independently associated with young age (<33 years, median age of the controls) [odds ratio (OR) 7·93, 95% confidence interval (CI) 3·90–16·10], and H. pylori IgG seropositivity (OR 1·93, 95% CI 1·10–3·40). Typhoid fever was independently associated with H. pylori IgG seropositivity, but not with elevated gastrin concentration. Therefore, the association suggests a common risk of environmental exposure to both bacteria, e.g. poor hygiene, rather than a causal relationship via reduced gastric acid production.