Upper endoscopy, also known as esophagogastroduodenoscopy (EGD), is a diagnostic medical procedure used to visualize the upper part of the gastrointestinal tract, which includes the esophagus, stomach, and the first part of the small intestine (duodenum). This procedure is performed using an endoscope, a flexible tube with a light and camera attached to it.