A bile duct is any of a number of long tube-like structures that carry bile, and is present in most vertebrates. The bile duct is separated into three main parts the fundus, body, and neck which are superior, middle, and inferior respectively. 
 Bile is required for the digestion of food and is secreted by the liver into passages that carry bile toward the hepatic duct. It joins the cystic duct (carrying bile to and from the gallbladder) to form the common bile duct which then opens into the intestine.
 The top half of the common bile duct is associated with the liver, while the bottom half of the common bile duct is associated with the pancreas, through which it passes on its way to the intestine. It opens into the part of the intestine called the duodenum via the ampulla of Vater.
 The biliary tree (see below) is the whole network of various sized ducts branching through the liver.
 The path is as follows: bile canaliculi → canals of Hering →  interlobular bile ducts → intrahepatic bile ducts → left and right hepatic ducts merge to form →  common hepatic duct exits liver and joins →  cystic duct (from gall bladder) forming →  common bile duct →  joins with pancreatic duct →  forming ampulla of Vater →  enters duodenum.
 Inflation of a balloon in the bile duct causes, through the vagus nerve, activation of the brain stem and the insular cortex, prefrontal cortex, and somatosensory cortex.
 Blockage or obstruction of the bile duct by gallstones, scarring from injury, or cancer prevents the bile from being transported to the intestine and the active ingredient in the bile (bilirubin) instead accumulates in the blood. This condition results in jaundice, where the skin and eyes become yellow from the bilirubin in the blood. This condition also causes severe itchiness from the bilirubin deposited in the tissues. In certain types of jaundice, the urine will be noticeably darker, and the stools will be much paler than usual. This is caused by the bilirubin all going to the bloodstream and being filtered into the urine by the kidneys, instead of some being lost in the stools through the ampulla of Vater.
 Jaundice is commonly caused by conditions such as pancreatic cancer, which causes blockage of the bile duct passing through the cancerous portion of the pancreas; cholangiocarcinoma, cancer of the bile ducts; blockage by a stone in patients with gallstones; and from scarring after injury to the bile duct during gallbladder removal.
 Biliary drainage is performed with a tube or catheter (called a biliary drain, biliary stent or biliary catheter) by a surgeon or, commonly, an interventional radiologist. It can be used to relieve a blockage in the bile duct, either permanently or as a temporary solution before definite treatment such as surgery. The drain can be placed percutaneously through the liver, with the procedure then being called percutaneous transhepatic biliary drainage (PTBD). This can additionally be performed as part of a percutaneous transhepatic cholangiography, then a form of interventional radiology. A biliary drain can also be used to take bile samples for diagnostic workup or disease monitoring, as well as providing a route of administration for medical substances.
 A surgically created passage between the common bile duct and the jejunum in a procedure called a choledochojejunostomy, can be carried out to relieve the symptoms of biliary obstruction as well as allows the bile duct to drain.
 In infants with biliary atresia, hepatoportoenterostomy is an alternative method of providing bile drainage.
 Cholangiocarcinoma or bile duct cancer is a form of cancer that is composed of mutated epithelial cells (or cells showing characteristics of epithelial differentiation) that originate in the bile ducts. Cholangiocarcinoma is considered to be an incurable and rapidly lethal cancer unless both the primary tumor and any metastases can be fully removed by surgery. No potentially curative treatment exists except surgery, but most people have advanced stage disease at presentation and are inoperable at the time of diagnosis.
 In cholecystectomy there is a slight risk (0.3–0.5%) of injury of the bile ducts, most commonly of the common bile duct. This complication can range from mild forms, which are easy to address during the operation, to more severe forms. If not addressed such injury can be debilitating and lead to considerable morbidity. Such injury can be prevented by routinely using X-ray investigation of the bile ducts (intraoperative cholangiography).