The brown color of feces comes from a pigment called stercobilin, which is the end product of your body breaking down old red blood cells. Every day, your body recycles millions of red blood cells that have reached the end of their roughly 120-day lifespan. The pigment from those cells takes a winding journey through your liver, bile, and intestines before it ends up coloring your stool.
From Red Blood Cells to Brown Pigment
The process starts with hemoglobin, the protein that makes blood red. When old red blood cells are broken down (mostly in the spleen), hemoglobin releases a molecule called heme. An enzyme converts heme into biliverdin, which is green, and then another enzyme quickly converts biliverdin into bilirubin, which is yellow-orange. This is the same compound responsible for the yellowish tint of a healing bruise.
Your liver processes bilirubin by attaching sugar molecules to it, making it water-soluble so it can be secreted into bile. Bile is stored and concentrated in your gallbladder until you eat, especially fatty foods. At that point, your gallbladder contracts and releases bile into the upper part of your small intestine. Along with helping digest fats, this bile carries bilirubin into your digestive tract.
Gut Bacteria Finish the Job
Bilirubin alone wouldn’t make your stool brown. The critical final steps happen in your large intestine, where gut bacteria transform bilirubin into new compounds. First, bacteria strip off those sugar molecules the liver attached. Then they reduce the unconjugated bilirubin into urobilinogen, a colorless compound. From there, bacteria further reduce urobilinogen into stercobilinogen, which oxidizes into stercobilin, the pigment that gives feces its characteristic brown color.
The bacteria responsible for this conversion belong primarily to the class Clostridia within the Firmicutes group. Specific species known to perform this work include Clostridium ramosum, Clostridium perfringens, Clostridioides difficile, and Bacteroides fragilis. More recently, researchers at the Brantley Hall lab identified additional species capable of bilirubin reduction, including Clostridium symbiosum and Ruminococcus gnavus. Without a healthy population of these bacteria, bilirubin doesn’t get fully converted, which is one reason newborns (whose guts haven’t yet been colonized) often have yellow or green stools.
Not all the urobilinogen stays in the intestine. Some is reabsorbed into the bloodstream and filtered by the kidneys. Urobilinogen and its oxidized form, urobilin, are what give urine its yellow color. So the same recycling pathway is responsible for coloring both your urine and your stool.
Why Stool Sometimes Isn’t Brown
Since brown stool depends on bile reaching the intestine and bacteria having enough time to process it, anything that disrupts either step can change the color.
Pale or Clay-Colored Stool
If bile can’t flow into the intestine, stool loses its pigment entirely and turns white, gray, or light tan. This happens when something blocks the biliary system. Gallstones are a common culprit, but other causes include hepatitis, cirrhosis, fatty liver disease, narrowing of the bile ducts, pancreatitis, and tumors affecting the liver, bile ducts, or pancreas. Persistently pale stool is worth taking seriously because it often signals a problem with the liver, gallbladder, or pancreas.
Green Stool
Bile itself starts out green. As it travels through the intestine, bacteria gradually convert its pigments from green to yellow to brown. When food moves through the large intestine too quickly, such as during a bout of diarrhea, bile doesn’t have time to be fully broken down. The result is green stool. Eating large amounts of leafy greens can also turn stool green, thanks to chlorophyll.
Yellow or Greasy Stool
Yellow, foul-smelling stool that appears greasy or floats often indicates excess fat that wasn’t properly absorbed. This can result from conditions that impair fat digestion, such as pancreatic insufficiency, celiac disease, or infections like giardia. Because fat dilutes the normal brown pigment and adds its own pale color, the stool shifts toward yellow.
Black Stool
Black, tarry stool can result from bleeding in the upper digestive tract (the stomach or upper small intestine). Blood that travels through the full length of the GI tract gets broken down by digestive enzymes, turning hemoglobin much darker than its original red. This is distinct from bright red blood, which typically originates closer to the rectum.
Medications can also cause black stool without any bleeding. Bismuth subsalicylate, the active ingredient in Pepto-Bismol, reacts with small amounts of sulfur in your saliva and digestive system to form bismuth sulfide, a harmless black compound. Iron supplements produce a similar effect.
Foods That Override the Normal Color
Certain plant pigments are concentrated enough to temporarily overpower stercobilin’s brown. Beets contain betanin, a red pigment that can turn stool (and urine) reddish, sometimes alarming enough to be mistaken for blood. Blueberries and other deeply colored fruits contain anthocyanins that can darken stool to a deep blue or near-black. Carrots and sweet potatoes are rich in beta-carotene, which can push stool toward orange. Even pistachios, thanks to their chlorophyll and carotenoid content, can give stool a greenish tint.
These color changes from food are temporary and harmless. They typically resolve within a day or two after you stop eating the food in question. The underlying brown from stercobilin is still being produced; it’s simply being masked by a stronger pigment passing through.

