Gastritis: symptoms, H. pylori testing and treatment

In everyday speech, gastritis means almost any upper belly discomfort, but medically it is inflammation of the stomach lining. The more useful question is whether you carry Helicobacter pylori, a bacterium that causes ulcers and gastritis and is linked to stomach cancer. Here is who should be tested, how testing works and why a follow-up test after treatment matters.

Illustration of a pink stomach, a green spiral bacterium and a blister pack of tablets on a pale blue background

In short

  • Gastritis means inflammation of the stomach lining. Many people with it have no symptoms, and others have indigestion.
  • H. pylori infection is the most common cause of gastritis and the main cause of peptic ulcers, and it is linked to stomach cancer.
  • Breath, stool and blood tests can detect it, and an endoscopy with biopsies is sometimes needed.
  • Treatment combines antibiotics with acid-reducing medicine, and a follow-up test confirms the infection is gone.
  • Black stools, vomiting blood or severe belly pain need emergency care.

Gastritis, indigestion and ulcers are different things

NIDDK describes gastritis as inflammation of the stomach lining, and gastropathy as damage with little or no inflammation. Most people have no symptoms, and some have indigestion or bleeding in the stomach.

A peptic ulcer is a sore on the lining of the stomach or the first part of the small intestine. NIDDK lists abdominal pain, feeling full too soon, nausea, bloating and belching as ulcer symptoms. The NHS describes the typical pain as burning upper belly pain, often worse at night. Because these symptoms overlap, you cannot tell them apart without testing.

Why H. pylori matters

MedlinePlus says H. pylori is a bacterium that infects the stomach. It is the main cause of peptic ulcers, can also cause gastritis, and is linked to stomach cancer. It often causes no symptoms.

It is unclear exactly how it spreads, according to MedlinePlus: possibly through contaminated food or water, or contact with saliva or other body fluids. Washing your hands after using the bathroom and before eating, eating properly prepared food and drinking from a clean source may reduce the risk. There is no vaccine.

The other common cause of ulcers is regular use of anti-inflammatory painkillers (NSAIDs) such as ibuprofen, which the NHS and NIDDK both list.

Who should be tested

NIDDK says that when you have upper belly symptoms, a doctor may review your medical and family history, examine you, and order tests for H. pylori, an upper GI endoscopy or an upper GI series. The same tests check for complications such as bleeding.

In practice, testing makes the most sense when you have ulcer-type pain, persistent indigestion, or a history of ulcers. Because most people with the infection feel nothing, testing is a decision to make with your provider rather than something to do on a hunch, and it should not replace a check-up for symptoms that keep returning.

How to get tested

MedlinePlus says blood, breath and stool tests can detect H. pylori, and sometimes an upper endoscopy with biopsy is needed. The NHS describes the breath test: you swallow a tablet or drink a special solution and then breathe into a tube.

  1. Ask before the test.Check with your provider or the testing clinic whether your current medicines, including acid reducers and antibiotics, need adjusting beforehand. Do not stop them on your own.
  2. Choose the test with your provider.The best test depends on your symptoms, age and history, and your provider can say whether an endoscopy is needed.
  3. Plan a follow-up.Retesting after treatment confirms the infection is gone, according to MedlinePlus and the NHS.

Treatment: clearing the infection

NIDDK says H. pylori is treated with medicines, and MedlinePlus describes a combination of antibiotics and acid-reducing medicines. The NHS says treatment usually lasts between one week and two months, followed by tests to confirm it worked.

Take the full course as prescribed even if you feel better. If you have side effects, call your provider before you stop. Do not use leftover antibiotics from earlier illnesses.

Painkillers and the stomach

Regular use of NSAIDs such as ibuprofen is one of the two most common causes of ulcers, according to NIDDK. If an NSAID is the cause, NIDDK says a doctor may change your medicines. Ask before you take an anti-inflammatory painkiller regularly, and tell your provider about any you already use.

Food and lifestyle

NIDDK says research has not found that diet plays an important role in ulcers, and doctors do not recommend a special diet or avoiding specific foods to treat or prevent them. The NHS suggests stopping smoking, avoiding foods and drinks that trigger your symptoms, and managing stress.

NIDDK also points out that H. pylori gastritis can impair iron absorption, and autoimmune gastritis can impair iron and vitamin B12 absorption. If you are tired or have had a low blood count, mention this to your provider.

When an endoscopy is needed

NIDDK says an upper GI endoscopy with biopsies can diagnose gastritis, find the cause and check for complications. The NHS says a provider may refer you for a gastroscopy, where a thin, flexible tube with a camera is passed into the stomach. Your provider decides when it is warranted, for example when symptoms are persistent or when tests are inconclusive.

When to see a doctor and red flags

See your provider for ongoing upper belly pain, indigestion that keeps returning, or if you use anti-inflammatory painkillers regularly and have stomach symptoms.

Red flags: the NHS lists vomiting bright red blood or vomit that looks like coffee grounds, blood in your stool or black, sticky stools, severe belly pain and sudden chest pain as emergencies. Call 911.

Questions to bring:

  • Should I be tested for H. pylori, and which test?
  • Do I need to adjust my medicines before testing?
  • How will we confirm the infection is gone?
  • Could a painkiller I take be involved?

Questions and answers

Does H. pylori always need to be treated?

If tests confirm it, treatment is generally the next step. MedlinePlus calls the bacterium the main cause of ulcers and links it to gastritis and stomach cancer, though your provider decides which medicines suit you.

Why do I need to check before the test?

Some medicines may interfere with certain tests. The NHS says to check with your provider or testing service before any test, so ask what applies to you.

Can a blood test show that the infection is gone?

MedlinePlus lists blood, breath and stool tests for detecting the infection, and the NHS says follow-up tests confirm that treatment worked. Ask your provider which test they use for the check afterwards.

Do I need a strict diet for gastritis?

No special diet is recommended to treat or prevent ulcers, according to NIDDK. The NHS suggests avoiding foods and drinks that trigger your own symptoms.

Does H. pylori spread in families?

How it spreads is unclear, according to MedlinePlus, though contaminated food or water and contact with saliva are possible routes. Washing hands is one sensible precaution.

Sources

  1. NIDDK — Gastritis and gastropathy
  2. NIDDK — Peptic ulcers (stomach ulcers)
  3. NHS — Stomach ulcer
  4. MedlinePlus — Helicobacter pylori infections

Sources checked on 29 October 2026.