BACKGROUND: Aflatoxins have been reported as a significant pollutant in feed, capable of causing harm to the liver, gastrointestinal tract and kidneys of piglets. However, research on the interactions among aflatoxin B1 (AFB1), bile acid (BA) metabolism and gut microbiota is limited. METHODS: In this study, piglets were treated with AFB1 and antibiotics (ABX) to evaluate the interaction between AFB1 and gut microbiota. Subsequently, the roles of the farnesoid X receptor (FXR) and sterol 12α-hydroxylase (CYP8B1) in AFB1 absorption were studied by using FXR agonists obeticholic acid (OCA) and Cyp8b1-knockout (KO) mice, respectively. RESULT: AFB1 inhibited bile salt hydrolase (BSH) activity in ileal microbiota, downregulated ileal FXR expression, and upregulated CYP8B1 expression in liver, increasing the proportion of 12α-OH BAs and potentially enhancing AFB1 absorption. ABX treatment reduced AFB1 absorption and liver damage, and unexpectedly increased BSH activity, counteracting the AFB1-induced downregulation of FXR and upregulation of CYP8B1. OCA reactivated ileal FXR, reduced AFB1 absorption, and alleviated liver damage. Furthermore, Cyp8b1-KO mice showed increased resistance to AFB1-induced liver damage by lowering AFB1 absorption. CONCLUSIONS: These results underscore the significance of gut microbiota and BAs in AFB1 absorption, suggesting new strategies to mitigate health risks from AFB1 in piglets.