Clogging of endoscopic stents necessitates their replacement in many patients with malignant obstructive jaundice and limits their use in benign strictures. We studied the basic mechanism of clogging to find ways to prevent it. We did light and electron microscopy studies of blocked and functioning stents, which were prepared so that organic structures would be preserved. The material blocking the lumina was composed of a matrix of bacterial cells and their fibrillar anionic extracellular products. Crystals of calcium bilirubinate, calcium palmitate, and cholesterol were embedded within this matrix. Bacterial cells were attached to the stent surface by a fibrillar matrix, suggesting that the initial event in stent clogging is the development of an adherent bacterial biofilm. Bacterial enzyme activity (beta-glucuronidase and phospholipase) leads to the deposition of crystals. The use of antibacterial plastics in the manufacture of stents may reduce bacterial adhesion and stent clogging.