A bilirubin test measures the amount of bilirubin in a blood sample. Bilirubin is a brownish yellow substance found in bile. It is produced when the liver breaks down old red blood cells. Bilirubin is then removed from the body through the stool (feces) and gives stool its normal color.