Looking down into the toilet bowl and seeing poop that looks a bit different than usual can be a little stressful — but it isn’t always cause for alarm.

If you’ve noticed your stools are looking black and tarry, it could be connected to a more serious issue like bleeding in your gastrointestinal tract. But it could also be due to certain things you’ve been eating.

Read on for some of the reasons your poop might be taking on a darker hue, and when to talk with a doctor.

Dark-colored foods

Sometimes, the simplest reason is the actual reason: If you’ve noticed your poop has gone from its usual brown to a blacker color, it could be due to the sorts of foods you’ve been eating. This is especially true if you haven’t noticed any additional gastrointestinal symptoms.

Some foods that can turn your poop black:

Iron supplements

Many people take iron supplements for anemia, a condition in which an individual’s blood has a lower-than-normal amount of red blood cells, causing feelings of tiredness and weakness. These supplements can have a few side effects, including

  • nausea
  • constipation
  • black stools

If you take iron supplements and are having issues with side effects, talk with your doctor. There are a few different types of iron supplements, and some may be easier on your stomach than others.

Medicines containing bismuth

Medicines containing bismuth subsalicylate — like Pepto-Bismol — can turn your stools black. Ingesting too much bismuth subsalicylate over a prolonged period of time can also turn your tongue and teeth black.

Ulcers

Ulcers are open sores on the lining of the digestive tract. While they’re not always painful, they can cause:

  • a burning sensation in the stomach
  • indigestion
  • heartburn
  • a general feeling of being unwell

When ulcers start to bleed, they can create more severe symptoms, including black, “sticky,” tarry stools (which are darker in color due to blood mixing with digestive fluids). Because this is a more severe symptom, you should talk with your doctor ASAP if these dark stools are accompanied by any of the manifestations above.

Upper gastrointestinal (GI) bleeding

In addition to ulcers, there are a few other conditions that can cause bleeding in the upper GI tract, which in turn can lead to black, tarry stools. Black stools caused by these kinds of upper GI issues are sometimes referred to as melena. A few of these conditions include:

Many of these conditions are serious and include a host of other gastrointestinal symptoms. If your stools have been black and tarry for a few days, and are accompanied by stomach aches and vomiting, you should seek medical help immediately.

Esophageal varices

The esophagus is a tube that carries foods and liquids to the stomach. When veins inside the esophagus become swollen — a condition usually connected to cirrhosis or other advanced liver diseases — they can occasionally rupture and cause both red, bloody stools, or black, tarry stools.

It’s important to call your doctor immediately if you are already aware that you are living with liver disease, and start to experience black stools along with:

  • muscle cramps
  • stomach discomfort
  • rapid weight loss
  • jaundice

If your symptoms are not severe enough to warrant a hospital visit, your doctor will likely ask about your medical history and perform a physical examination to try to determine the cause of your unusual stool color. They’ll probably order blood tests and a stool sample, and may also suggest imaging (like X-rays) to see the inside of your digestive tract.

Your doctor may also schedule a gastroscopy or colonoscopy to assess the condition of your gut.

A colonoscopy is often performed while you’re under sedation. Your doctor will insert a thin, flexible tube through your anus into the rectum with a camera on the end to see the inside of your colon and look for the cause of your symptoms.

A gastroscopy is similar in nature to a colonoscopy but focuses on the esophagus, stomach, and small intestine. The thin tube is inserted through your throat, rather than the anus.

Treating black stools varies according to what is causing the condition.

If you notice that you’ve been eating a lot of blueberries, blackberries, and other dark foods, limit your intake for a few days and see if it makes a difference.

The same goes for iron supplements and medicines containing bismuth subsalicylate: If you think your black stools may be connected to taking either of these, talk with your doctor about safe alternatives.

Ulcers can have different causes, but milder forms are commonly treated by:

  • proton pump inhibitors (PPIs), which reduce the amount of acid in your stomach so the ulcers can heal
  • H2 receptor antagonists, which also reduce the amount of acid in the stomach
  • over-the-counter antacids
  • reduced use of nonsteroidal anti-inflammatory drugs (NSAIDs)

Surgery is also an option for more severe cases of bleeding ulcers.

If your black stools are due to a condition that is causing upper GI bleeding, your treatment will vary depending on the severity of the condition.

Don’t wait to talk with your doctor if your black, tarry stools are accompanied by gastrointestinal discomfort or other intense symptoms — make an appointment right away or head to the nearest ER.

Black stools can be caused by a variety of issues, from eating too much black licorice to bleeding in your gastrointestinal tract. The key to identifying how serious your condition is are the other symptoms that are present.

If you are experiencing nausea, stomach upset, dizziness, or abdominal pain along with black stools, contact your doctor quickly.