The impact of diets varying in type and level of carbohydrates resistant to endogenous enzymes and lignin on the establishment and location of Ascaris suum and Oesophagostomum dentatum was investigated experimentally. Fifty worm-free pigs, from a specific pathogen-free farm were used. The animals were assigned randomly to 5 diets and infected with 600 infective A. suum eggs and 6000 infective larvae of O. dentatum per pig. The diets consisted of a traditional ground barley plus protein feed (diet A), commercial full-constituent pelleted feed (diet B), barley flour plus protein (diet C), barley flour, inulin (Raftiline® ST, ORAFTI, Tienen, Belgium), sugar beet fibre plus protein (diet D), and barley flour, wheat bran, and protein (diet E). The faecal egg excretion was followed and the pigs were slaughtered at 8 weeks p.i. and samples taken from the small and large intestine. Intestinal contents were analysed for worm burdens, worm location and female worm fecundity along with the concentration of insoluble (chromic oxide) and soluble (polyethylene glycol-4000) markers, lignin, non-starch polysaccharides (NSP) and organic acids. In all diet groups A. suum worm burdens were low and comparable, whereas the O. dentatum worm burdens were significantly higher in pigs fed the diets with high levels of NSP and lignin (diets A and E) than in pigs fed diets B, C, and D. The present study suggests that a diet rich in lignin and insoluble NSP's provides favourable conditions for the establishment of O. dentatum in the large intestine of pigs while it is unlikely that the concentration of short-chain fatty acids and pH plays any major role.