Stomach Ulcer Tests: Endoscopy and H. Pylori Testing

Stomach Ulcer Tests: Endoscopy and H. Pylori Testing

Black or bloody stool, vomiting blood or material that looks like coffee grounds, or sudden severe belly pain are emergency signs. Call 911 or go to an emergency department now. These do not wait for an appointment.

What exactly is a stomach ulcer?

A stomach ulcer is a sore in the stomach lining deep enough to break through the surface layer and expose the tissue underneath. Peptic ulcer disease is the umbrella term for these breaks in the lining of the stomach or of the duodenum, the first part of the small intestine, and they extend past the thin muscle layer that sits under the surface cells 1.

The stomach lives in a permanent chemical standoff. Acid and the digestive enzyme pepsin are corrosive by design, and a layer of mucus, bicarbonate and fast renewing surface cells keeps them off the wall. Ulcers develop when the balance between those damaging factors and the lining's own defence and repair capacity tips the wrong way 2.

That definition matters for testing, because it tells you what a test has to do. Blood cannot show a break in the lining. Breath cannot show a break in the lining. Only looking at the lining, or seeing an indirect footprint such as blood loss, gets you there.

Location also matters. An ulcer in the stomach itself and an ulcer in the duodenum behave somewhat differently, and the clinician's next step is not identical for the two. Stomach ulcers are usually sampled during endoscopy, because the appearance of the lining on its own does not settle what the tissue is doing 1.

Which symptoms point toward an ulcer, and which do not?

The pattern that most often prompts testing is a burning, gnawing or hollow pain high in the middle of the abdomen that comes and goes, often changing with meals or waking someone at night. Fullness after small amounts of food, bloating, belching and nausea travel with it.

The awkward part is that this pattern is not specific. Indigestion, reflux and functional dyspepsia produce much the same complaints, which is why a clinician cannot settle the question in the room without testing 5. Running the logic backwards is just as unreliable. A large share of people with peptic ulcers have no typical symptoms at all, and the first sign can be a complication such as bleeding 4.

So symptoms are a reason to be tested, not an answer in themselves. They do shape urgency. Pain plus weight loss, vomiting that will not settle, difficulty swallowing, or signs of blood loss such as unusual fatigue and breathlessness moves the evaluation forward faster.

If you want the symptom picture in more detail, including how the timing of pain differs between the stomach and the duodenum, see this guide to stomach ulcer symptoms.

Why does it matter whether an ulcer is really there?

It matters because the complications are what cause harm, and because the cause of the ulcer decides what happens next. Studies indicate that bleeding is the most common complication of peptic ulcer disease 4, and perforation of the wall and obstruction of the stomach outlet are the other recognised ones 3.

The second reason is cause. An ulcer driven by Helicobacter pylori infection and an ulcer related to something a person takes are not the same problem wearing the same symptoms, and the path forward differs. Clinical practice guidelines recommend testing for H. pylori in people with peptic ulcer disease 7. What follows a positive result is a treatment decision, and treatment decisions belong to a licensed provider.

There is a third, quieter reason. An ulcer that oozes slowly does not announce itself. It drains iron stores over weeks, and the person notices tiredness or breathlessness on stairs long before they notice anything in the toilet. Finding the source is what stops the drain.

What happens at the first appointment?

The first appointment is a structured history, a physical examination and a decision about which test comes first. Evaluation starts with the pattern of symptoms and a careful review of everything the person takes, including items bought without a prescription 5.

Expect questions about where the pain sits, what it feels like, whether food or an empty stomach changes it, how long it has been going on, whether it wakes you at night, and what you have already tried. Expect questions about previous ulcers, previous H. pylori testing, family history, alcohol and smoking.

Bring a written list of everything you take. Some medicines raise ulcer risk and some can affect the accuracy of H. pylori testing, so the list is not a formality. Ask your prescriber before changing or stopping anything on it. Never stop something on your own to get a cleaner test result.

The examination is mostly about ruling in urgency. A clinician will press on the abdomen, check your pulse and blood pressure, look for pallor, and in some cases check the stool for blood. Alarm features, including unintended weight loss, persistent vomiting, trouble swallowing, a mass, or signs of anemia, push an endoscopy forward rather than waiting to see.

Which tests are used, and what does each one answer?

There are four tools that do nearly all the work, and each answers a different question. Reading them as a set is what makes the picture clear.

Test What it looks at What it can answer What it does not answer
Upper endoscopy The lining of the esophagus, stomach and duodenum, seen directly Whether an ulcer is present, where it sits, whether it is bleeding Why it formed, without samples and further testing
Samples taken during endoscopy Small pieces of tissue from the lining Whether H. pylori is present in the tissue, what the lining looks like under a microscope Nothing useful unless an endoscopy is being done anyway
Urea breath test Breath samples before and after a test solution Whether an active H. pylori infection is present Whether an ulcer exists, or where it is
Stool antigen test A single stool sample Whether an active H. pylori infection is present Whether an ulcer exists, or how deep it is
Complete blood count Red cells and oxygen carrying capacity Whether blood has been lost over time Where in the gut the blood came from
X-ray test after swallowing a coating liquid The outline of the stomach and duodenum A larger crater or narrowing, in selected cases Small lesions, tissue samples, H. pylori status

The sequence depends on age, symptoms and risk. A younger adult with classic symptoms and no alarm features is often tested for H. pylori first, because that answer changes management without a procedure. Alarm features, or symptoms that persist after an initial approach, point toward endoscopy 5. The clinician in front of you makes that call.

What is an upper endoscopy actually like?

Upper endoscopy is the test that confirms an ulcer, because it looks at the lining directly and allows tissue samples to be taken in the same sitting 4. A thin flexible tube with a camera and a light on the end is passed through the mouth, down the esophagus, into the stomach and into the first part of the duodenum.

You will usually be asked not to eat or drink for a set period beforehand, and the clinic gives you the exact timing. Most people are given sedation, and often a numbing spray for the throat, so the procedure itself is not something you spend much time remembering. The tube does not interfere with breathing. If sedation is used, you will need someone to take you home and you should not drive that day.

During the procedure the endoscopist can see whether an ulcer is present, how large it is, where it sits and whether there are signs of recent or active bleeding. Small tissue samples can be taken painlessly, because the lining itself has no pain nerves of the kind skin has. Those samples can be tested for H. pylori and examined under a microscope. If an ulcer is bleeding, it can often be managed through the same scope during the same procedure.

Endoscopy is a procedure, so it carries a small risk of bleeding, of injury to the wall of the gut and of a reaction to sedation. Your endoscopist will explain the balance in your particular case before you consent.

How is H. pylori tested for?

H. pylori is tested for either without a procedure, using a breath test or a stool test, or from tissue taken during endoscopy. Noninvasive testing is the usual starting point when a procedure is not otherwise needed 8.

The bacterium matters here because H. pylori infection is associated with peptic ulcer disease, and it is one of the two dominant causes 6.

The urea breath test works on a simple trick of chemistry. H. pylori produces an enzyme that splits urea, so you breathe into a container, swallow a test solution, wait, then breathe into a second container. If the gas pattern changes in the expected way, the organism is active in your stomach right now.

The stool antigen test looks for pieces of the organism in a single stool sample collected at home and returned to the lab. Both of these tell you about current infection rather than past exposure, which is what a clinician needs.

Antibody testing from a blood sample is a different animal. Antibodies can stay in circulation after an infection has gone, so a positive result does not separate a current infection from an old one, and it is not the preferred way to confirm active infection 7. The practical detail of how each test is collected, and what a positive or negative result actually means, is set out in this guide to the h pylori test.

What does a blood count add to the picture?

A complete blood count cannot see an ulcer, but it can show the footprint of one that has been bleeding. The marker carrying most of that signal is Hemoglobin, the oxygen carrying protein in red blood cells, and a result below the standard range points toward blood loss, low iron stores or another cause that a clinician works through.

Slow bleeding from an ulcer often goes unnoticed for weeks. It shows up as tiredness, breathlessness on stairs, pale skin or an unexpected drop on a routine blood count rather than as anything visible. Red cell size and iron storage markers tend to move alongside it, which is why they are usually run together.

What the result means, how the test is run and how to read its ranges are covered in full on the Hemoglobin biomarker page.

Which blood markers are worth looking at alongside it?

The useful set around a suspected ulcer is the one that describes blood loss and iron supply over time, not a single number on a single day. Hemoglobin is the anchor, and the ranges below are the ones most labs use.

Marker Lab range FitScript optimal range
Hemoglobin, men As printed on your lab report 14 to 16 g/dL
Hemoglobin, women As printed on your lab report 12 to 15 g/dL

Reference ranges vary by lab, age and sex, so always read your result against the range printed on your own report. FitScript optimal ranges are optimization targets rather than diagnostic cut-offs, and a value inside or outside either range is a conversation with a clinician, not a conclusion.

Several other markers earn their place in that conversation, described in words because their ranges differ too much between labs to be worth quoting. Ferritin reflects stored iron and tends to fall before hemoglobin does, so it can flag a slow drain early. Serum iron and transferrin saturation describe how much iron is actually in transit. Mean corpuscular volume, the average size of your red cells, often drops when iron supply has been short for a while. A general inflammation marker such as CRP is sometimes added to see whether anything inflammatory is running in the background.

Patterns beat single values here. A hemoglobin that has drifted down over three draws says more than one result sitting a fraction under a range. That is the logic behind a membership like FitScript, where 150+ biomarkers are tested per year and Atlas, the AI health advisor, reads each result against your own history rather than against a one off snapshot.

What do black or tarry stools mean?

Black, tarry, strong smelling stool can mean blood from the upper digestive tract has been digested on its way through, and that is a reason for urgent assessment rather than a wait and see. The same goes for visibly bloody stool or for vomiting blood.

Not every dark stool is blood. Certain foods and certain supplements darken stool in a way that is harmless and reverses within a day or two of stopping them. The trouble is that the two look similar enough from the outside that guessing is a poor strategy, especially alongside upper abdominal pain, dizziness, a racing heart or new fatigue.

A clinician can usually separate the two quickly with a stool test for blood and a blood count. The breakdown of what else turns stool dark, and which features point toward blood, is covered in this guide to black stool causes.

If black or bloody stool comes with lightheadedness, fainting, a fast pulse or severe pain, that is an emergency. Call 911.

How do you get ready for these tests?

Preparation is short, and most of it is about accuracy. The clinic sends you specific instructions, and those instructions override anything general written here.

For upper endoscopy you will be asked to stop eating and drinking for a defined period before the appointment so the stomach is empty and the view is clear. If sedation is planned, arrange a ride home and clear the rest of the day. Bring your medicine list and your insurance details, and tell the team about any allergies, bleeding problems, heart or lung conditions and previous reactions to sedation.

For a urea breath test you will usually be asked to come fasting, because food interferes with the measurement. For a stool antigen test, the lab provides a collection kit with its own instructions, and following them exactly matters more than people expect.

For both H. pylori tests, some medicines taken in the weeks beforehand can suppress the organism enough to produce a falsely negative result. This is why the clinician asks for the full list. Ask your prescriber about timing rather than making a change yourself.

If an X-ray test of the stomach outline is ordered instead, the scan preparations are explained by the imaging department, and they generally involve fasting and swallowing a liquid that coats the lining so it shows up on the image.

Why can a test come back negative when symptoms continue?

A negative test narrows the field, it does not close the case. There are a handful of ordinary reasons a result can read negative while something real is going on.

The most common is timing around medicines. Recent use of some medicines can reduce the accuracy of breath and stool testing for H. pylori, which is why guidance stresses checking what a person has taken before interpreting a negative result 7. Ask your prescriber about this rather than acting on your own.

Sampling is another. Tissue testing during endoscopy depends on taking samples from where the organism actually is, and infection can be patchy. Technique, collection and handling all affect the yield of noninvasive testing too.

The third reason is the simplest. Upper abdominal pain, fullness and nausea are common without any ulcer being present, and functional dyspepsia produces a nearly identical complaint 5. A negative workup can be a genuine, useful answer that redirects the search.

What if the tests are clear but the pain is not?

Persisting symptoms after a negative workup deserve a return visit rather than silence. What happens next depends on which test was negative and what the symptoms are doing.

If an endoscopy was normal

A normal endoscopy is meaningful. It rules the lining itself in or out as the source, and it shifts the conversation toward other explanations for upper abdominal pain, including the gallbladder, the pancreas, reflux without visible damage and functional causes. Your clinician decides which direction to take and which further tests, if any, are worth running.

If an H. pylori test was negative

A negative breath or stool test is interpreted alongside what you have been taking, because recent medicines can mask an active infection. Repeating the test after an interval, or testing a different way, is sometimes the answer, and the clinician sets that timing.

If an infection was found and managed earlier

After management of an H. pylori infection, confirming that the organism is gone is part of standard care rather than an optional extra, and guidelines address testing for clearance after treatment 7. Treatment and retesting decisions both belong to a licensed provider.

If symptoms change character

New vomiting, new weight loss, difficulty swallowing, pain that becomes constant, or any sign of blood loss resets the clock. That is a reason to be seen again promptly rather than to wait for a scheduled review.

What raises the chance of an ulcer forming?

Two causes dominate. Research suggests that Helicobacter pylori infection and some medicines account for the large majority of peptic ulcers 1. On the medicine side, the only safe instruction is to list everything you take, including items bought over the counter, and ask your prescriber whether any of it is relevant to your stomach.

Lifestyle factors sit alongside those two. Research suggests that smoking is associated with peptic ulcer disease 3. Heavy alcohol intake and severe physiological stress, such as critical illness, are also recognised contributors to damage of the stomach lining.

Age and previous ulcer history both raise the index of suspicion, which is why a clinician asks about them early. Knowing which of these applies to you does not make a diagnosis, but it changes which test gets ordered first and how quickly.

When is it worth talking to a clinician?

Any upper abdominal pain that keeps coming back over weeks, wakes you at night, changes with meals, or sits alongside nausea, fullness or appetite loss is worth a clinical appointment. So is unexplained fatigue or a hemoglobin result that has drifted below the standard range, because slow blood loss is one of the explanations a clinician works through.

Some situations need prompt rather than routine attention, including vomiting that will not settle, unintended weight loss, difficulty swallowing, or a blood count that drops without explanation. These are worth discussing with a clinician promptly, not at the next convenient slot.

And the emergency list does not change. Black or bloody stool, vomiting blood or coffee ground material, sudden severe belly pain, fainting or a racing heart means calling 911 or going to an emergency department straight away.

This page is educational and is not medical advice. Discuss your symptoms, your results and any treatment with a clinician or licensed provider who can review your full history.

Key takeaways

References

  1. Peptic Ulcer Disease: A Review. JAMA, 2024.
  2. Peptic ulcer pathophysiology. The Medical Clinics of North America, 1991.
  3. Peptic ulcer disease. Lancet, 2017.
  4. Peptic ulcer disease. Lancet, 2024.
  5. Peptic Ulcer Disease. Primary Care, 2023.
  6. Peptic Ulcer Disease and Helicobacter pylori infection. Missouri Medicine, 2018.
  7. Evidence-based clinical practice guidelines for peptic ulcer disease 2020. Journal of Gastroenterology, 2021.
  8. Peptic ulcer. Medicina Clinica, 2023.

Common questions

Can a blood test on its own confirm a stomach ulcer?

No. A blood count can show that blood has been lost, and low hemoglobin or low iron stores can point a clinician toward bleeding somewhere in the digestive tract, but it cannot show a break in the stomach lining or say where it is. Confirming an ulcer means looking at the lining, which is what upper endoscopy does. Your clinician decides which tests are needed and in what order.

Which test is the most reliable way to confirm an ulcer?

Upper endoscopy, because it views the lining of the esophagus, stomach and duodenum directly and allows small tissue samples to be taken at the same time. Those samples can also be checked for H. pylori. Breath and stool tests answer a different question, which is whether an H. pylori infection is currently active.

What is involved in an H. pylori breath test?

You usually attend fasting, breathe into a collection container, swallow a test solution, wait a short period and then breathe into a second container. The lab compares the two samples. It is painless and involves no needles or procedure, and the clinic gives you the exact fasting instructions beforehand.

Should I stop any of my medicines before H. pylori testing?

Never stop anything on your own. Some medicines taken in the weeks before a breath or stool test can make the result read negative when an infection is actually present, which is why the clinician asks for a complete list of everything you take, including items bought without a prescription. Ask your prescriber about timing, and let the testing team know what you have taken.

How would I know if an ulcer is bleeding?

Visible signs include black tarry stool, bloody stool, or vomiting blood or material that looks like coffee grounds. These need emergency care, so call 911 or go to an emergency department. Slower bleeding is quieter and often shows up only as fatigue, breathlessness on stairs, pale skin or a falling hemoglobin on a routine blood count.

Do I need to fast before these tests?

For upper endoscopy and for a urea breath test, yes, you will be asked to stop eating and drinking for a set period so the result is accurate and the view is clear. The exact timing comes from the clinic performing the test. A stool antigen test does not require fasting, and the lab supplies a collection kit with its own instructions.

What happens after a positive H. pylori result?

A licensed provider reviews the result alongside your symptoms and history and decides what comes next, including whether an endoscopy is needed. Treatment decisions belong to that provider. Confirming that the infection has cleared afterwards is part of standard follow up, and your clinician sets the timing for that retest.

My tests came back normal but the pain is still there. What now?

Book a follow up rather than letting it ride. A normal result narrows the field and shifts the search toward other causes of upper abdominal pain, and sometimes a test needs repeating because of timing or sampling. If symptoms change, with new vomiting, weight loss, trouble swallowing or any sign of blood loss, ask to be seen promptly.

Related reading