Digestive Diseases and ERCP Testing

Medically Reviewed by Zilpah Sheikh, MD on March 20, 2024
8 min read

ERCP, which is short for endoscopic retrograde cholangiopancreatography, is a procedure used to diagnose and treat problems related to pancreatic ducts and bile ducts. 

The word “endoscopic” means it’s done with an endoscope -- a long, thin tube with a light and camera that allows doctors to see inside your body. The endoscope is inserted through your mouth and slowly lowered through your stomach to the duodenum. This is the part of your small intestine just after your stomach. 

Once the tip of the endoscope is in place, the doctor injects dye through the tube and takes X-rays to see where the dye travels. The goal is to see how the dye flows through the pancreatic and bile ducts. This will show if there are any blockages and where they are. Your doctor may also be able to do some procedures, such as removing gallstones from the bile duct, while doing the ERCP.

What are bile and pancreatic ducts?

Your bile and pancreatic ducts are what help the fluids in your digestive system go where they should. Your liver makes bile, a fluid that breaks down fats. Your bile ducts carry the bile to your gallbladder and your duodenum. Your pancreas makes pancreatic juice, which contains enzymes your body needs to break down the food you eat. The pancreatic ducts allow the pancreatic juice to flow into the duodenum.


A magnetic resonance cholangiopancreatography, MRCP for short, is similar to an ERCP. But an ERCP is an invasive test and an MRCP is not. With an ERCP, a doctor has to insert an endoscope through your mouth to do the test. An MRCP isn't invasive; there is no endoscope. Instead, a radiation technologist injects a special dye, a contrast agent, into your vein by an intravenous (IV) method. This dye circulates through your blood system.

While the dye circulates, the technologist takes images using a magnetic resonance imaging (MRI) machine. The images show the dye moving through the pancreatic and bile ducts.

Not everyone can have an MRCP. People who might fall into this category include those who:

  • Are allergic to the dye
  • Have claustrophobia and cannot go in an MRI machine
  • Have kidney disease or kidney failure
  • Are pregnant
  • Plan on becoming pregnant within a year of having the test

Since an MRCP is only for viewing your ducts, if the images show something that needs to be removed or fixed, you'll need another procedure to treat it.

Your doctor may recommend an ERCP if you have signs of a problem with your bile or pancreatic ducts, like yellowing of the skin or eyes (jaundice) or unexplained abdominal pain. An ERCP can find issues including:

  • Gallstones or other blockages, including tumors, in the bile ducts
  • Blockages or narrowing in the pancreatic ducts
  • Leaking from bile or pancreatic ducts
  • Infections 

When is an ERCP needed?

All invasive procedures have risks, so doctors typically only recommend an ERCP instead of an MRCP if they want to do a treatment at the same time.

An ERCP is considered a low-risk procedure; however, complications can occur. These can include pancreatitis, infections, bowel perforation, and bleeding. Patients undergoing an ERCP for treatment, such as for gallstone removal, face a higher risk of complications than patients undergoing the test to diagnose a problem. Your doctor will discuss the risks of possible complications before the test.

Who performs an ERCP?

An ERCP is most commonly done by a gastroenterologist, a specialist in the stomach and intestinal system. There are other health care professionals who will also be present to help numb your throat, start an IV, and ensure that you are comfortable throughout the procedure.

Before having an ERCP, let your doctor know about any special medical conditions you have, including:

  • Pregnancy
  • Lung conditions
  • Heart conditions
  • Allergies to any medications
  • If you have diabetes and use insulin. You may need to adjust the dosage of insulin the day of the test. Your diabetes doctor will help you with this adjustment. Bring your diabetes medication with you so you can take it after the procedure.
  • If you are taking blood-thinning medications such as aspirin, clopidogrel (Plavix), dipyridamole (Persantine), enoxaparin (Lovenox), or warfarin (Coumadin), your primary doctor may ask you to hold these medications or prescribe an alternate method for thinning your blood before the procedure.

A few other things to keep in mind:

  • Don't discontinue any medication without first consulting with your primary or referring doctor.
  • Don't eat or drink anything for 8 hours before the procedure.
  • You may be drowsy for some time after sedation, so you should ask for help from a responsible adult who can take you home after the procedure. You shouldn't drive or operate machinery for at least 8 hours because the medication given during the procedure may cause drowsiness.
  • You may need to stay overnight in the hospital after the procedure, so pack personal items you may need.

Most ERCP procedures take 1-2 hours, and you should be able to go home the same day. On the day of your ERCP, you’ll get anesthesia via an IV, and your medical team may numb your throat to limit your discomfort. 

Your doctor will begin the procedure by placing the endoscope down your throat, reaching the top of your small intestine. 

ERCP Procedure infographic

Doctors can do several treatments during an ERCP, which prevents the need for a separate surgery or procedure. They include:

ERCP gallstones removal

Once the endoscope is in place, the doctor can insert special tools through the scope to reach gallstones in the bile duct. Breaking up or removing the stones can be done in one of two ways. A mechanical lithotripsy uses a tool that captures the stone with a wire basket. The stones are crushed in the basket and then removed through the endoscope. The other procedure, intraductal electrohydraulic lithotripsy, uses a very thin probe inserted through the endoscope to reach the stone. A generator is connected to the probe and sends shock waves to break the stone. Once the stone is broken, it is removed with the wire basket.

ERCP biopsy

If your doctor suspects there may be a tumor or cancer cells, an ERCP makes it possible to take tissue samples from the ducts. Passing a small tool through the endoscope, the doctor collects tissue samples to send to a lab to be investigated.

ERCP dilation

Sometimes pancreatic and bile ducts become too narrow, blocking fluid from flowing through. In order to dilate, or widen, these, your doctor inserts a catheter (tube) with a balloon on the end through the endoscope. Once it reaches the narrowed area, the balloon is inflated to push the walls open. The balloon is then deflated and pulled back out through the endoscope.

ERCP stent placement

If a duct is narrowed and can’t stay open on its own, your doctor can insert a stent, a narrow tube, that stays in the narrowed section of the duct. This stent is inserted through the endoscope and acts as a wall support. It's usually removed after a few months. A stent might also be used if a duct is leaking. 

ERCP sphincterotomy

Some people develop a narrowing of a part of their ducts called the sphincter of Oddi. A sphincterotomy opens or widens the area. Using a special tool inserted through the endoscope, your doctor makes a small cut into the muscle that surrounds the opening of the bile and pancreatic ducts to fix the issue.

After your ERCP procedure, you'll stay in a recovery room for about 1-2 hours for observation. You may feel a temporary soreness in your throat. Suck on throat lozenges to relieve the pain.

A responsible adult must take you home after the procedure. It's also recommended that someone stay with you for 24 hours after the procedure.

Don't drive or operate machinery for at least 8 hours. It's recommended that you stay overnight within a 30-minute drive of the hospital so you can get to the emergency room quickly to be evaluated, if necessary.

The results of your ERCP test will be sent to your primary or referring doctor, who will discuss them with you. If the results of the procedure show that prompt medical attention is needed, the necessary arrangements will be made and your referring doctor will be notified.

An ERCP is considered a low-risk procedure. But some people do have complications during or after an ERCP. They include:

  • Reaction to the sedative that could affect your breathing or heart
  • Allergic reaction to the contrast dye
  • Injury to the stomach or duodenum by the endoscope, like bowel perforation or bleeding
  • A leak in the bile ducts, caused by the instruments
  • Pancreatitis -- irritation or swelling (inflammation) of the pancreas
  • Infection

Patients getting an ERCP for treatment, such as for gallstone removal, face a higher risk of complications than patients undergoing the test to diagnose a problem. Your doctor will discuss the risks of possible complications before the test.

If you have any of the following symptoms within 72 hours after ERCP, call your doctor and seek emergency care:


Doctors use ERCP to help detect, diagnose, and treat problems related to the bile and pancreatic ducts. ERCP is considered to be a low-risk procedure, but it may not be right for some people, such as if you are pregnant or have kidney disease. Because of the sedative you'll get before the procedure, you can't drive yourself home afterward. It’s important that someone brings you home and stays with you for about a day after to watch for any complications.

Does ERCP remove gallstones?

ERCP can remove gallstones if they're found in the bile duct. A doctor can't use ERCP to remove gallstones that are still in the gallbladder.

What is the difference between ERCP and endoscopy?

The word endoscopy is a blanket term. It's a test that uses an endoscope but can be performed in various parts of the body, including the lungs, bladder, and colon. An ERCP is a specific endoscopic test that looks at the bile and pancreatic ducts.

Is ERCP a high-risk procedure?

No, ERCP isn't a high-risk procedure. As with all invasive procedures, though, there's a risk of complications.