BACKGROUND: Early colonization with bifidobacteria and lactobacilli is postulated to protect children from allergy, while Clostridium (C.) difficile colonization might be associated with allergic disease. Previous studies of infant gut microbiota in relation to subsequent allergy development have mostly employed culture-dependent techniques, studied genera of bacteria and the follow-up period was limited to 2 years. OBJECTIVE: To relate gut microbiota in early infancy, notably bifidobacteria and lactobacilli at species level, to allergy development during the first 5 years of life and study if environmental factors influence the early infant gut microbiota. METHODS: Fecal samples were collected at 1 week, 1 month and 2 months after birth from 47 Swedish infants, followed prospectively to 5 years of age. Bacterial DNA was analysed with real-time PCR and related to allergy development, family size as well as endotoxin and Fel d 1 levels in house dust samples. Primers binding to C. difficile, four species of bifidobacteria, two lactobacilli groups and Bacteroides fragilis were used. Children regarded as allergic manifested allergic symptoms and were skin prick test positive during their first 5 years while non-allergic children were neither. RESULTS: Children who developed allergy were significantly less often colonized with lactobacilli group I (Lactobacillus (L.) rhamnosus, L. casei, L. paracasei), Bifidobacterium adolescentis and C. difficile during their first 2 months. Infants colonized with several Bifidobacterium species had been exposed to higher amounts of endotoxin and grew up in larger families than infants harbouring few species. CONCLUSION: A more diverse gut microbiota early in life might prevent allergy development and may be related to the previously suggested inverse relationship between allergy, family size and endotoxin exposure.