ObjectiveThe purpose of this study was to describe the changes in the gut microbiome of patients with cirrhosis and hepatic encephalopathy (HE), as well as quantify the variations in short-chain fatty acid (SCFA) and tryptophan metabolite levels in serum and faeces.MethodsFresh faeces and serum were collected from 20 healthy volunteers (NC group), 30 cirrhosis patients (Cir group), and 30 HE patients (HE group). Then, 16S rRNA sequencing and metabolite measurements were performed using the faeces. Gas chromatography‒mass spectrometry and ultrahigh-performance liquid chromatography-tandem mass spectrometry were used to measure SCFA and tryptophan levels, respectively. The results were analysed by SIMCA16.0.2 software. Differences in species were identified using MetaStat and t tests. The correlations among the levels of gut microbes and metabolites and clinical parameters were determined using Spearman correlation analysis.ResultsPatients with cirrhosis and HE had lower microbial species richness and diversity in faeces than healthy volunteers; these patients also had altered β-diversity. Serum valeric acid levels were significantly higher in the HE group than in the Cir group. Serum SCFA levels did not differ between the Cir and NC groups. Serum melatonin and 5-HTOL levels were significantly higher in the HE group than in the Cir group. The Cir and NC groups had significant differences in the levels of eight serum tryptophan metabolites. Furthermore, the levels of faecal SCFAs did not differ between the HE and Cir groups. Faecal IAA-Ala levels were significantly lower in the HE group than in the Cir group. There were significant differences in the levels of 6 faecal SCFAs and 7 faecal tryptophan metabolites between the Cir and NC groups. Certain gut microbes were associated with serum and faecal metabolites, and some metabolites were associated with certain clinical parameters.ConclusionReduced microbial species richness and diversity were observed in patients with HE and cirrhosis. In both serum and faeces, the levels of different SCFAs and tryptophan metabolites showed varying patterns of change. In HE patients, the levels of some serum tryptophan metabolites, and not SCFAs, were correlated with liver function and systemic inflammation. Systemic inflammation in patients with cirrhosis was correlated with faecal acetic acid levels. In summary, this study identified metabolites important for HE and cirrhosis.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12967-023-04262-9.