Upper Gastrointestinal Endoscopy

Browse By All Topics


Upper Gastrointestinal Endoscopy

Test Overview

An upper gastrointestinal (UGI) endoscopy is a procedure that allows your doctor to look at the interior lining of your esophagus, your stomach, and the first part of your small intestine (duodenum) through a thin, flexible viewing instrument called an endoscope. The tip of the endoscope is inserted through your mouth and then gently moved down your throat into the esophagus, stomach, and duodenum (upper gastrointestinal tract).

Since the entire upper gastrointestinal (GI) tract can be examined during this test, the procedure is sometimes called esophagogastroduodenoscopy (EGD).

Using the endoscope, your doctor can look for ulcers, inflammation, tumors, infection, or bleeding. Tissue samples can be collected (biopsy), polyps can be removed, and bleeding can be treated through the endoscope. Endoscopy can reveal problems that do not show up on X-ray tests, and it can sometimes eliminate the need for exploratory surgery.

Why It Is Done

An upper gastrointestinal (UGI) endoscopy may be done to:

  • Find problems in the upper gastrointestinal (GI) tract. These problems can include:
  • Find the cause of vomiting blood (hematemesis).
  • Find the cause of symptoms, such as upper abdominal pain or bloating, trouble swallowing (dysphagia), vomiting, or unexplained weight loss.
  • Find the cause of an infection.
  • Check the healing of stomach ulcers.
  • Look at the inside of the stomach and upper small intestine (duodenum) after surgery.
  • Look for a blockage in the opening between the stomach and duodenum (gastric outlet obstruction).

Endoscopy may also be done to:

  • Check for an esophageal injury in an emergency (for example, if the person has swallowed poison).
  • Collect tissue samples (biopsy) for examination in the laboratory.
  • Remove growths from inside the esophagus, stomach, or small intestine (gastrointestinal polyps).
  • Treat upper gastrointestinal bleeding, including bleeding caused by engorged veins in the esophagus (esophageal varices).
  • Remove foreign objects that have been swallowed.
  • Look for bleeding that may be causing a decrease in the amount of oxygen-carrying substance (hemoglobin) found in red blood cells (anemia).

How To Prepare

Before having an upper gastrointestinal endoscopy, tell your doctor if you:

  • Are allergic to any medicines, including anesthetics.
  • Are taking any medicines.
  • Have bleeding problems or take blood-thinning medicine, such as warfarin (Coumadin).
  • Have heart problems.
  • Are or might be pregnant.
  • Have diabetes and take insulin.
  • Have had surgery or radiation treatments to your esophagus, stomach, or the upper part of your small intestine.

Do not eat or drink anything for 6 to 8 hours before the test. An empty stomach helps your doctor see your stomach clearly during the test. It also reduces your chances of vomiting. If you vomit, there is a small risk that your stomach contents could enter your lungs (aspiration). If the test is done in an emergency, a tube may be inserted through your nose or mouth to empty your stomach.

You may be asked to sign a consent form that says you understand the risks of the test and agree to have it done.

Talk to your doctor about any concerns you have regarding the need for the test, its risks, how it will be done, or what the results will mean. To help you understand the importance of this test, fill out the medical test information form(What is a PDF document?).

You may be asked to stop taking aspirin products or iron supplements 7 to 14 days before the test. If you take blood-thinning medicines regularly, discuss with your doctor how to manage your medicine.

Do not take sucralfate (Carafate) or antacids on the day of the test. These medicines can interfere with your doctor's ability to view the gastrointestinal tract.

If biopsy samples are taken or polyps are removed during the test, bleeding may also occur. This bleeding usually stops on its own without treatment. To reduce this risk, avoid aspirin and nonsteroidal anti-inflammatory drugs (NSAIDs) for several days before the endoscopy. If you take blood-thinning medicine, you may be instructed to stop the medicine temporarily before the test.

Before the test, you will put on a hospital gown. If you are wearing dentures, jewelry, contact lenses, or glasses, remove them. For your own comfort, empty your bladder before the test begins.

Arrange to have someone take you home after the test because you will be given a sedative before the test.

How It Is Done

A gastrointestinal endoscopy may be done in a doctor's office, a clinic, or a hospital. An overnight stay in the hospital usually is not needed. The test is most often performed by a doctor who specializes in problems of the digestive system (gastroenterologist). The doctor may also have an assistant. Some family medicine doctors, internists, and surgeons are also trained to do endoscopy.

Before the procedure, blood tests may be done to check for a low blood count or clotting problems. Your throat may be numbed with an anesthetic spray, gargle, or lozenge to relax your gag reflex and make it easier to insert the endoscope into your throat.

During the test, you may receive a pain medicine and a sedative through an intravenous (IV) line in your arm or hand. These medicines reduce pain and will make you feel relaxed and drowsy during the test. You may not remember much about the actual test.

You will be asked to lie on your left side with your head bent slightly forward. A mouth guard may be placed in your mouth to protect your teeth from the endoscope. Then the lubricated tip of the endoscope will be guided into your mouth, and your doctor may gently press your tongue out of the way. You may be asked to swallow to help move the tube along. It is helpful to remember that the instrument is no thicker than many foods you swallow and will not cause problems with breathing.

Once the endoscope is in your esophagus, your head will be tilted upright. This makes it easier for the scope to slide down your esophagus. During the procedure, try not to swallow unless requested to. An assistant may remove the saliva from your mouth with a suction device, or you can allow the saliva to drain from the side of your mouth.

Your doctor will slowly move the endoscope while looking through an eyepiece or watching on a video monitor to examine the walls of your esophagus, stomach, and duodenum. Air or water may be injected through the scope to help clear a path for the scope or to clear its lens, and suction may be applied to remove air or secretions.

A camera attached to the endoscope takes pictures for viewing on the monitor and stores some pictures for later study. The doctor may also insert tiny instruments (forceps, loops, swabs) through the endoscope to collect tissue samples (biopsy) or remove growths. The biopsy test is completely painless.

To make it easier for your doctor to see different parts of your upper gastrointestinal (GI) tract, you may be repositioned or have gentle pressure applied to your belly. When the examination is completed, the endoscope is slowly withdrawn.

After the test

The test usually takes 30 to 45 minutes, but it may take longer, depending upon what is found and what is done during the test.

After the test, you will be observed for 1 to 2 hours until the medicines wear off. If your throat was numbed before the test, you should not eat or drink until your throat is no longer numb and your gag reflex has returned to normal.

When you are fully recovered, you can go home. You will not be able to drive or operate machinery for 12 hours after the test. Your doctor will tell you when you can resume your usual diet and activities. Do not drink alcohol for 12 to 24 hours after the test.

How It Feels

You may notice a brief, sharp pain when the intravenous (IV) needle is placed in a vein in your arm. The local anesthetic sprayed into your throat usually tastes slightly bitter and will make your tongue and throat feel numb and swollen. Some people report that they feel as if they cannot breathe at times because of the tube in their throat, but this is a false sensation caused by the anesthetic. There is always plenty of breathing space around the tube in your mouth and throat. Remember to relax and take slow, deep breaths.

During the test, you may feel very drowsy and relaxed from the sedative and pain medicines. You may have some gagging, nausea, bloating, or mild abdominal cramping as the tube is moved. If you are having pain, alert your doctor with an agreed-upon signal or a tap on the arm. Even though you won't be able to talk during the procedure, you can still communicate.

The suction machine used to remove secretions may be noisy but does not cause pain. The removal of biopsy samples is also painless.

You will feel groggy after the test until the medicine wears off, usually in a few hours. Many people report that they remember very little of the test because of the sedative given before and during the test.

After the test, you may belch and feel bloated for a while. You may also have a tickling, dry throat or mouth; slight hoarseness; or a mild sore throat. These symptoms may last several days. Throat lozenges and warm saltwater gargles can help relieve the throat symptoms. Do not drink alcohol after the test.


Complications from gastrointestinal endoscopy are rare. There is a slight risk of puncturing your throat (esophagus), stomach, or upper small intestine (duodenum). If this happens, you may need to have surgery to fix it. There is also a slight chance of infection after an endoscopy.

Bleeding may also occur from the test or if a tissue sample (biopsy) is taken, but this usually stops on its own without treatment. If you vomit during the examination and some of the material you vomit enters your lungs, aspiration pneumonia is a possible risk. If it develops, it can be treated with antibiotics.

An irregular heartbeat may occur during the test but nearly always subsides on its own without treatment.

The procedure has more risk for people with serious heart disease, older adults, and those who are frail or physically weakened. Although complications are rare, you should discuss your specific risks with your doctor.

After the test

After the test, call 911 or other emergency services immediately if you develop:

After the test, call your doctor immediately if you:

  • Feel short of breath or dizzy.
  • Have symptoms of infection, such as fever or chills.
  • Vomit blood, whether it is fresh and red or is old and looks like coffee grounds.


An upper gastrointestinal (UGI) endoscopy is a procedure that allows your doctor to look at the interior lining of your esophagus, your stomach, and the first part of your small intestine (duodenum) through a thin, flexible viewing instrument called an endoscope.

Your doctor may be able to talk to you about some of the findings with you immediately after your upper gastrointestinal endoscopy. But the medicines given to help relax you may impair your memory, so your doctor may wait until they wear off completely. Other results are usually available in 2 to 4 days. Tests for certain infections may take several weeks.

Upper gastrointestinal endoscopy

The esophagus, stomach, and upper small intestine (duodenum) look normal.


Inflammation or irritation is found in the esophagus (esophagitis), stomach (gastritis), or small intestine.

Bleeding, an ulcer, a tumor, a tear, or dilated veins (esophageal varices) are found in the esophagus, stomach, or duodenum.

A hiatal hernia is found.

A too-narrow (stricture) section is found in the esophagus.

A foreign object is found in the esophagus, stomach, or duodenum.

A biopsy sample may be taken to:

  • Find out if tumors or ulcers contain cancer cells.
  • Identify a type of bacteria called Helicobacter pylori (H. pylori).

Many conditions can change the results of an upper gastrointestinal endoscopy. Your doctor will talk with you about any abnormal results that may be related to your symptoms and past health.

What Affects the Test

You may not be able to have the test or the results may not be helpful if you just had another test that uses barium contrast material. An upper gastrointestinal endoscopy should not be done less than 2 days after you have an upper gastrointestinal (GI) series so your doctor can see your stomach and small intestine.

What To Think About

  • An upper gastrointestinal endoscopy is the best way to examine your esophagus, stomach, and upper small intestine (duodenum). Your doctor can take a tissue sample to test for Helicobacter pylori infection, which is believed to be the main cause of stomach or duodenal ulcers. To learn more, see the topic Helicobacter Pylori Tests.
  • Cancer can be identified or ruled out using endoscopy.
  • Endoscopy may be done after an upper gastrointestinal series test identifies a problem. To learn more, see the topic Upper Gastrointestinal Series.
  • Endoscopy can be safely performed on small children.
  • Endoscopic retrograde cholangiopancreatogram (ERCP) is a test of the ducts that drain the liver, gallbladder, and pancreas. It can be done to find the cause of jaundice if your doctor thinks you may have blockage of the bile or pancreatic ducts and when other tests (such as ultrasound, liver scan, and X-ray studies) are not clear. To learn more, see the topic Endoscopic Retrograde Cholangiopancreatogram (ERCP).


Other Works Consulted

  • Chernecky CC, Berger BJ (2008). Laboratory Tests and Diagnostic Procedures, 5th ed. St. Louis: Saunders.
  • Fischbach FT, Dunning MB III, eds. (2009). Manual of Laboratory and Diagnostic Tests, 8th ed. Philadelphia: Lippincott Williams and Wilkins.
  • Pagana KD, Pagana TJ (2010). Mosby’s Manual of Diagnostic and Laboratory Tests, 4th ed. St. Louis: Mosby Elsevier.


ByHealthwise Staff
Primary Medical ReviewerE. Gregory Thompson, MD - Internal Medicine
Specialist Medical ReviewerJerome B. Simon, MD, FRCPC, FACP - Gastroenterology
Last RevisedMarch 7, 2012

This information does not replace the advice of a doctor. Healthwise, Incorporated disclaims any warranty or liability for your use of this information. Your use of this information means that you agree to the Terms of Use.

How this information was developed to help you make better health decisions.

© 1995-2012 Healthwise, Incorporated. Healthwise, Healthwise for every health decision, and the Healthwise logo are trademarks of Healthwise, Incorporated.