Ingestible sensors are potentially a powerful tool for monitoring human health. Sensors have been developed that can, for example, provide pH and pressure readings or monitor medication, but capsules that can provide key information about the chemical composition of the gut are still not available. Here we report a human pilot trial of an ingestible electronic capsule that can sense oxygen, hydrogen, and carbon dioxide. The capsule uses a combination of thermal conductivity and semiconducting sensors, and their selectivity and sensitivity to different gases is controlled by adjusting the heating elements of the sensors. Gas profiles of the subjects were obtained while modulating gut microbial fermentative activities by altering their intake of dietary fibre. Ultrasound imaging confirmed that the oxygen-equivalent concentration profile could be used as an accurate marker for the location of the capsule. In a crossover study, variations of fibre intake were found to be associated with differing small intestinal and colonic transit times, and gut fermentation. Regional fermentation patterns could be defined via hydrogen gas profiles. Our gas capsule offers an accurate and safe tool for monitoring the effects of diet of individuals, and has the potential to be used as a diagnostic tool for the gut.