Diet has a significant impact on fecal microbiota, which in turn plays an important role in human health. To evaluate the impact of dietary habits on fecal microbiota, we investigated the fecal microbial composition in vegetarians and omnivores using 16S rRNA gene sequencing, and estimated the correlation between fecal microbiota, body mass and diet. The dietary data showed that vegetarians consumed more plant-based foods rich in dietary fiber, omnivores consumed more animal-based foods rich in fat and overweight and obese people consumed more high-energy foods. Compared to omnivores, vegetarians had greater richness and diversity in their fecal microbiota. TheFirmicutes/Bacteroidetesratio was lower and thePrevotella/Bacteroidesratio was higher in vegetarians. The meat intake correlated positively with the proportion ofBacteroidesand negatively with the proportion ofPrevotella. The composition and diversity in fecal microbiota in the normal weight group, overweight group and obesity group were similar to that of vegetarians and omnivores, respectively. This paper revealed the distinctive characteristics of fecal microbiota in vegetarians and omnivores. The omnivorous diet contained more fat, which reduced the fecal microbial diversity, and was more likely to lead to being overweight or obese.