The microbial communities that colonize different regions of the human gut influence many aspects of health. In the healthy state, they contribute nutrients and energy to the host via the fermentation of nondigestible dietary components in the large intestine, and a balance is maintained with the host's metabolism and immune system. Negative consequences, however, can include acting as sources of inflammation and infection, involvement in gastrointestinal diseases, and possible contributions to diabetes mellitus and obesity. Major progress has been made in defining some of the dominant members of the microbial community in the healthy large intestine, and in identifying their roles in gut metabolism. Furthermore, it has become clear that diet can have a major influence on microbial community composition both in the short and long term, which should open up new possibilities for health manipulation via diet. Achieving better definition of those dominant commensal bacteria, community profiles and system characteristics that produce stable gut communities beneficial to health is important. The extent of interindividual variation in microbiota composition within the population has also become apparent, and probably influences individual responses to drug administration and dietary manipulation. This Review considers the complex interplay between the gut microbiota, diet and health.