How to Diagnose a Stomach Ulcer: Tests and Symptoms

Stomach ulcers are diagnosed through a combination of symptom evaluation, testing for the bacteria H. pylori, and in many cases, a direct look inside the stomach with an endoscope. The specific path depends on your age, symptom severity, and whether you have any warning signs like bleeding. Most people start with non-invasive tests and only move to endoscopy if those results or their symptoms call for it.

Symptoms That Prompt Testing

The hallmark symptom is a dull or burning pain in the upper abdomen, often between meals or at night when the stomach is empty. Heartburn and nausea are also common. These symptoms overlap heavily with acid reflux and a condition called functional dyspepsia, which produces similar discomfort without any visible damage to the stomach lining. Because the symptoms alone can’t confirm an ulcer, testing is almost always needed.

Some symptoms signal a more urgent situation. Vomiting blood (which can look red or dark, like coffee grounds), black or tarry stools, dizziness, and fainting all suggest the ulcer is bleeding. These require prompt medical attention and typically lead to faster, more direct diagnostic steps.

One useful clue before any formal testing: if over-the-counter antacids relieve your pain but it keeps coming back, that pattern is worth mentioning to your doctor. It suggests something is actively producing the irritation rather than a one-off bout of indigestion.

Testing for H. Pylori

Since the bacterium H. pylori causes the majority of stomach ulcers, testing for it is usually the first diagnostic step. Two non-invasive options are widely used, and both are highly accurate.

The urea breath test involves drinking a solution containing a special form of urea, then breathing into a collection bag. If H. pylori is present, it breaks down the urea and produces a detectable gas. This test picks up active infections with around 93 to 99% accuracy, depending on the lab’s threshold, and is equally reliable for confirming the bacteria have been cleared after treatment.

The stool antigen test detects H. pylori proteins in a stool sample. Pooled data from over 2,400 patients show the modern version of this test has about 94% sensitivity and 97% specificity, meaning it catches nearly all true infections and rarely gives a false positive.

Both tests share an important requirement: you need to stop taking proton pump inhibitors (common heartburn medications like omeprazole or lansoprazole) at least two weeks before testing, and antibiotics at least four weeks before. These drugs suppress H. pylori enough to hide it from the test without actually eliminating it, leading to false negatives. If you’re currently on either medication, let your doctor know so they can plan the timing.

A blood antibody test also exists but is less useful for diagnosis. It detects past exposure to H. pylori, not necessarily a current active infection, so it can’t distinguish between someone who was treated years ago and someone with an ongoing problem.

Upper Endoscopy

An upper endoscopy (sometimes called an EGD) is the most definitive way to diagnose a stomach ulcer. A thin, flexible tube with a camera is passed through your mouth, down your esophagus, through your stomach, and into the first section of the small intestine. The doctor examines the lining in real time, looking for ulcers, inflammation, or any other abnormalities. The entire procedure typically takes 5 to 10 minutes under sedation.

Endoscopy isn’t always the first test ordered. It’s more likely to be recommended if you’re over 55 with new symptoms, if your symptoms haven’t improved with initial treatment, if H. pylori tests came back negative but you’re still in pain, or if you have any of the alarm signs like bleeding or unexplained weight loss.

Why Biopsies Matter

During an endoscopy, the doctor will almost always take small tissue samples from the ulcer and surrounding area. This serves two purposes. First, biopsy tissue can be tested directly for H. pylori, which is especially useful if non-invasive tests were inconclusive. Second, and critically, biopsies help rule out stomach cancer. A small percentage of what looks like a benign gastric ulcer turns out to be malignant, and the only way to know is under a microscope.

Current guidelines recommend that all gastric ulcers receive a biopsy at the initial endoscopy. Even if the first biopsy comes back benign, a follow-up endoscopy is typically scheduled (usually 6 to 8 weeks later) to confirm the ulcer is healing. If early biopsies show precancerous changes, repeat sampling at follow-up has been shown to catch progression that would otherwise be missed. This two-step approach, initial biopsy plus repeat scope, catches essentially all ulcer-related cancers.

It’s worth noting that biopsies from areas that look completely normal can sometimes reveal disease. Many gastroenterologists take routine samples from standard locations in the stomach even when everything appears fine visually.

Barium Swallow X-Ray

Before endoscopy became widely available, the main imaging tool for ulcers was a barium swallow, also called an upper GI series. You drink a chalky liquid containing barium, which coats the lining of your digestive tract and makes it visible on X-ray. Ulcers show up as craters or irregularities in the coating.

This test can still detect ulcers, but it has significant limitations. It can’t take tissue samples, so it can’t test for H. pylori or rule out cancer. If something suspicious appears, you’ll still need an endoscopy afterward. For this reason, barium swallows have largely been replaced by endoscopy as the primary diagnostic tool. They may still be used when endoscopy isn’t available or when a patient can’t tolerate sedation.

Functional Dyspepsia: When No Ulcer Is Found

A substantial number of people with ulcer-like symptoms turn out to have no visible ulcer at all. When endoscopy shows a normal stomach lining, the diagnosis is typically functional dyspepsia, a catch-all term for chronic upper abdominal discomfort without a structural cause. It’s a diagnosis of exclusion, meaning it’s what’s left after testing rules out ulcers, cancer, and other identifiable problems.

Functional dyspepsia can mimic an ulcer closely. One subtype even produces the same pattern of epigastric pain that worsens with hunger and improves with food or antacids. The key difference is simply that the stomach lining looks intact. Knowing this is useful because it means a negative endoscopy isn’t a dead end. It’s actually a diagnosis in itself, and it opens the door to different treatment strategies focused on nerve sensitivity and motility rather than acid suppression alone.

Emergency Diagnosis of Complications

If an ulcer perforates (burns completely through the stomach wall), it becomes a surgical emergency. The diagnostic approach shifts entirely. An upright chest X-ray is the first step, and in about 75% of perforated ulcer cases, it reveals free air trapped under the diaphragm, a finding that essentially confirms the diagnosis on its own.

When the X-ray is inconclusive, a CT scan is the next step, with diagnostic accuracy as high as 98%. Free air on a CT scan typically appears just below the front abdominal wall, and even a scan without contrast dye is sufficient to detect it. Perforation presents with sudden, severe upper abdominal pain that feels dramatically different from the chronic ache of an uncomplicated ulcer, so the clinical picture usually points to the right diagnosis quickly.