The modification of microbiota composition to a 'beneficial' one is a promising approach for improving intestinal as well as overall health. Natural fibres and phytochemicals that reach the proximal colon, such as those present in various nuts, provide substrates for the maintenance of healthy and diverse microbiota. The effects of increased consumption of specific nuts, which are rich in fibre as well as various phytonutrients, on human gut microbiota composition have not been investigated to date. The objective of the present study was to determine the effects of almond and pistachio consumption on human gut microbiota composition. We characterised microbiota in faecal samples collected from volunteers in two separate randomised, controlled, cross-over feeding studies (n 18 for the almond feeding study and n 16 for the pistachio feeding study) with 0, 1·5 or 3 servings/d of the respective nuts for 18 d. Gut microbiota composition was analysed using a 16S rRNA-based approach for bacteria and an internal transcribed spacer region sequencing approach for fungi. The 16S rRNA sequence analysis of 528 028 sequence reads, retained after removing low-quality and short-length reads, revealed various operational taxonomic units that appeared to be affected by nut consumption. The effect of pistachio consumption on gut microbiota composition was much stronger than that of almond consumption and included an increase in the number of potentially beneficial butyrate-producing bacteria. Although the numbers of bifidobacteria were not affected by the consumption of either nut, pistachio consumption appeared to decrease the number of lactic acid bacteria (P< 0·05). Increasing the consumption of almonds or pistachios appears to be an effective means of modifying gut microbiota composition.