Hepatobiliary tumors, which include cholangiocarcinoma, hepatocellular carcinoma (HCC), and gallbladder cancer, are common cancers that have high morbidity and mortality rates and poor survival outcomes. In humans, the microbiota is comprised of symbiotic microbial cells (10-100 trillion) that belong to the bacterial ecosystem mainly residing in the gut. The gut microbiota is a complicated group that can largely be found in the intestine and has a dual role in cancer occurrence and progression. Previous research has focused on the crucial functions of the intestinal microflora as the main pathophysiological mechanism in HCC development. Intestinal bacteria produce a broad range of metabolites that exhibit a variety of pro- and anticarcinogenic effects on HCC. Therefore, probiotic alteration of the gut microflora could promote gut flora balance and help prevent the occurrence of HCC. Recent evidence from clinical and translational studies suggests that fecal microbiota transplant is one of the most successful therapies to correct intestinal bacterial imbalance. We review the literature describing the effects and mechanisms of the microbiome in the gut in the context of HCC, including gut bacterial metabolites, probiotics, antibiotics, and the transplantation of fecal microbiota, and discuss the potential influence of the microbiome environment on cholangiocarcinoma and gallbladder cancer. Our findings are expected to reveal therapeutic targets for the prevention of hepatobiliary tumors, and the development of clinical treatment strategies, by emphasizing the function of the gut microbiota.