Bile pigment, bilirubin, and biliverdin concentrations may change as a results of biliary tract cancer (BTC) altering the mechanisms of radical oxidation and heme breakdown. We explored whether changes in bile pigment components could help distinguish BTC from benign biliary illness by evaluating alterations in patients with BTC. We collected bile fluid from 15 patients with a common bile duct stone (CBD group) and 63 individuals with BTC (BTC group). We examined the bile fluid's bilirubin, biliverdin reductase (BVR), heme oxygenase (HO-1), and bacterial taxonomic abundance. Serum bilirubin levels had no impact on the amounts of bile HO-1, BVR, or bilirubin. In comparison to the control group, the BTC group had considerably higher amounts of HO-1, BVR, and bilirubin in the bile. The areas under the curve for the receiver operating characteristic curve analyses of the BVR and HO-1 were 0.832 (p<0.001) and 0.891 (p<0.001), respectively. Firmicutes was the most prevalent phylum in both CBD and BTC, according to a taxonomic abundance analysis, however the Firmicutes/Bacteroidetes ratio was substantially greater in the BTC group than in the CBD group. The findings of this study showed that, regardless of the existence of obstructive jaundice, biliary carcinogenesis impacts heme degradation and bile pigmentation, and that the bile pigment components HO-1, BVR, and bilirubin in bile fluid have a diagnostic significance in BTC. In tissue biopsies for the diagnosis of BTC, particularly for distinguishing BTC from benign biliary strictures, bile pigment components can be used as additional biomarkers.