The microbial composition and in vitro fermentation characteristics of human milk oligosaccharides (HMO), lacto-N-neotetraose (LNnT), a 2:1 mixture of polydextrose (PDX) and galactooligosaccharides (GOS), and short-chain fructooligosaccharides (scFOS) by pooled ascending colonic microbiota from 9- and 17-d-old formula-fed (FF) and sow-reared (SR) piglets were assessed. pH change and gas, SCFA, and lactate production were determined after 0, 2, 4, 8, and 12 h of incubation. In most donor groups, the pH change was greater for scFOS fermentation and lower for PDX/GOS than for other substrates. LNnT fermentation produced larger amounts of gas, total SCFA, acetate, and butyrate than did the other substrates, whereas HMO and scFOS produced higher amounts of propionate and lactate, respectively. In general, pH change, total SCFA, acetate, and propionate production were greater in pooled inoculum from FF and 9-d-old piglets, whereas SR-derived inoculum produced higher amounts of butyrate and lactate after 4 h fermentation. Gut microbiota were assessed by 16S ribosomal RNA V3 gene denaturing gradient gel electrophoresis analysis and real-time qPCR. Microbial structures differed among the 4 groups before fermentation, with higher counts of Bifidobacterium in SR piglets and higher counts of Clostridium cluster IV, XIVa, and Bacteroides vulgatus in FF piglets. Lactobacillus counts were higher in 9-d-old piglets than in 17-d-old piglets, regardless of diet. Bifidobacterium, Bacteroides, and clostridial species increased after 8 and 12 h fermentation on most substrates. In summary, piglet diet and age affect gut microbiota, leading to different fermentation patterns. HMO have potential prebiotic effects due to their effects on SCFA production and microbial modulation.