Skip to main content

Endoscopic retrograde cholangiopancreatography (ERCP)

Medically reviewed by Last updated on Feb 2, 2023.

What is the test?

Harvard Health Publishing

This procedure uses x-rays and an endoscope to see inside your digestive system and diagnose problems such as tumors, gallstones, and inflammation in your liver, gallbladder, bile ducts, or pancreas. Your doctor might use the test to investigate the cause of jaundice, upper abdominal pain, or unexplained weight loss.

How do I prepare for the test?

For a week before the test, don't take aspirin or other NSAIDs because they can irritate the stomach lining and increase your chance of bleeding during the procedure. Also tell the doctor if you are taking blood-thinning medicines or any diabetes medications. People with heart valve problems may also have to take antibiotics before the procedure. Avoid eating or drinking anything for eight hours before the test because it needs to be done on an empty stomach.

Tell your doctor if you are allergic to iodine, which is used for the procedure. Arrange for someone to drive you home because the medication given during the test will make you drowsy.

What happens when the test is performed?

The test is performed by a gastroenterologist in a procedure room or in a hospital. You are usually given a sedative through an IV line. You wear a hospital gown for the procedure and lie on your side against a backrest on an x-ray table. If you wear dentures, remove them. A local anesthetic is sprayed into your throat to prevent you from having a gag reflex (choking feeling) when the endoscope is placed inside. The endoscope is about a third of an inch in diameter and 2 1/2 feet long with a light on the end. It also has holes at the end that allow your doctor to pump air into your intestine, squirt fluid, and suck out liquid or air.

You are asked to swallow at the moment the tube is placed into your throat. This helps guide the endoscope into your esophagus. You are likely to feel pressure against your throat while the tube is in place and you might experience a "full" feeling in your stomach. The doctor or doctor's assistant gently advances the tube until it reaches your duodenum, the first part of the small intestine.

Next, the doctor inserts a slender tube, called a cannula, through the endoscope, and places the tip of the cannula into the bile duct or the pancreatic duct. These ducts are natural tubes of tissue that drain liquids out of the liver and pancreas. Once the tip of the cannula is lodged inside one of these ducts, the doctor injects contrast dye (usually iodine) through the cannula. The dye can be seen by x-rays, so it lights up the ducts clearly on an x-ray image, showing any obstruction (such as from gallstones or cancer) or unusual widening of the ducts (indicating an obstruction in the past). It also can light up the gallbladder in the X-Ray picture. The gallbladder connects to the bile duct. This test also helps the doctor to visualize the liver and pancreatic tissue around the ducts.

Depending on what the x-rays show, the doctor may undertake different interventions using tools operated through the endoscope. The doctor can remove gallstones or take biopsies of suspicious tissue. He or she can prop open narrowed bile ducts with a stent, a tube-shaped object that can be inserted through the scope. Depending on what is done, the test can take from 30 minutes to two hours.

What risks are there from the test?

The most common complication is abdominal pain after the procedure due to inflammation of the pancreas (pancreatitis). Other complications are rare, such as aspiration — accidentally inhaling saliva into the lungs, infection, and bleeding.

Must I do anything special after the test is over?

You are usually watched for one to two hours after this test. Typically, you can go home after the sedation wears off, which takes about an hour or two. Someone else should plan to drive you home. You can drink clear fluids when your gag reflex returns, which can take two to four hours. After that, you may resume your usual diet unless instructed otherwise.

It's important to call your doctor if you experience dizziness, chest pain, abdominal pain, back pain, difficulty or pain with swallowing, fever, black-colored or tarry stools, or vomiting of material that looks like coffee grounds. The last two symptoms can be signs of internal bleeding.

How long is it before the result of the test is known?

It usually takes a day or two to get the results, but in an emergency they can be ready in an hour.

Further information

Always consult your healthcare provider to ensure the information displayed on this page applies to your personal circumstances.