H. pylori is diagnosed through one of several tests that detect either the bacteria itself or your body’s response to it. The most reliable non-invasive options are the urea breath test and the stool antigen test, both of which identify an active infection. If you’re already having an endoscopy, your doctor can also test a small tissue sample taken during the procedure. The right test depends on your situation, but all of them require some preparation to get accurate results.
The Urea Breath Test
The urea breath test is one of the most widely used methods for detecting active H. pylori infection. It works by exploiting something unique about the bacteria: H. pylori produces large amounts of an enzyme called urease, which breaks down urea into ammonium and bicarbonate. The bicarbonate enters your bloodstream, travels to your lungs, and gets exhaled as carbon dioxide.
During the test, you swallow a capsule or drink a solution containing urea that’s been labeled with a special carbon isotope. If H. pylori is present in your stomach, the bacteria break down that labeled urea, and the tagged carbon dioxide shows up in your breath. You simply breathe into a collection device 10 to 20 minutes after swallowing the capsule, and the sample is analyzed for radioactivity or isotope levels. The whole process takes about 30 minutes and gives a clear positive or negative result.
This test is highly accurate for both initial diagnosis and for confirming the bacteria are gone after treatment. It’s also completely non-invasive, which makes it a first-line choice for most people.
The Stool Antigen Test
Stool antigen testing looks for H. pylori proteins directly in a stool sample. You provide a sample at home or at a lab, and it’s analyzed using antibodies that bind to H. pylori-specific proteins. Monoclonal versions of this test (which use lab-engineered antibodies for greater precision) are preferred over older polyclonal versions.
In clinical evaluations, stool antigen tests achieve a sensitivity around 77% and specificity above 80%, meaning they correctly identify most infections and rarely produce false positives. These numbers can shift depending on exactly how the test is performed and timed. At intermediate prevalence levels, the stool test reaches about 93% diagnostic accuracy, making it a strong option when a breath test isn’t available or practical.
Stool testing is also the more affordable non-invasive option. Cost analyses have found it runs roughly $126 to $127 per correct diagnosis at typical infection rates, compared to the higher cost of endoscopy-based methods. Like the breath test, it detects active infection only, which is exactly what you want when deciding whether treatment is needed.
Biopsy-Based Testing During Endoscopy
If you’re undergoing an upper endoscopy for symptoms like persistent stomach pain, ulcers, or other concerning findings, your doctor can take a small tissue sample (biopsy) from your stomach lining and test it for H. pylori on the spot. The most common approach is the rapid urease test: the biopsy is placed in a gel or solution containing urea and a color indicator. If H. pylori’s urease enzyme is present, it breaks down the urea, changes the pH, and triggers a visible color change within minutes to hours.
Rapid urease tests are inexpensive and fast compared to sending tissue to a pathology lab for microscopic examination. Studies comparing the two approaches have found no significant differences in sensitivity or specificity, and the rapid test actually performs well even in patients taking acid-suppressing medications. A pathologist can also examine the biopsy under a microscope to look for the bacteria directly, assess the degree of inflammation, and check for precancerous changes in the stomach lining. This gives more information but takes longer and costs more.
Endoscopy is not used purely for diagnosis in most cases. It’s reserved for people who already need the procedure for other clinical reasons, such as ruling out ulcers or stomach cancer.
Why Blood Tests Are Less Reliable
Blood (serology) tests for H. pylori check for antibodies your immune system produces in response to the bacteria. The problem is straightforward: antibodies can linger in your blood for months or even years after an infection has cleared. A positive blood test can’t distinguish between an active infection you have right now and one your body already fought off in the past. For this reason, blood antibody tests are not commonly used to diagnose H. pylori and are not recommended for confirming that treatment worked.
Current guidelines from the American College of Gastroenterology specifically recommend non-serologic testing, meaning breath tests, stool tests, or biopsy-based methods, for anyone being evaluated for H. pylori. This applies to initial diagnosis and to expanded screening of higher-risk groups, including people with precancerous stomach changes and household members of infected adults.
Medications That Interfere With Results
Several common medications can cause false-negative results on H. pylori tests by temporarily suppressing the bacteria without actually eliminating them. Proton pump inhibitors (PPIs), the acid-reducing medications often sold under names like omeprazole and pantoprazole, are the biggest culprit. If you’re taking a PPI, guidelines from the UK’s National Institute for Health and Care Excellence recommend stopping it at least two weeks before testing.
Antibiotics are even more disruptive. Taking any antibiotic for any reason in the four weeks before an H. pylori test can suppress bacterial levels enough to produce a falsely negative result. If you’ve recently completed a course of antibiotics for a sinus infection, urinary tract infection, or anything else, let your doctor know so testing can be rescheduled to the appropriate window.
These preparation rules apply to breath tests, stool tests, and biopsy-based methods alike. Skipping the washout period is one of the most common reasons for inaccurate results.
Testing After Treatment
Confirming that H. pylori is actually gone after treatment is not optional. The American College of Gastroenterology recommends proof of eradication in all patients who’ve been treated, using a stool antigen test, urea breath test, or gastric biopsy.
Timing matters here. You need to wait at least four weeks after finishing your antibiotic regimen before taking a follow-up test. Testing too early can pick up dying bacteria or residual antigens that no longer represent a live infection, leading to a false positive. It can also miss bacteria that were temporarily suppressed by antibiotics but are bouncing back, leading to a false negative. The four-week window gives your stomach enough time to return to its baseline state so the test reflects your actual infection status.
If the follow-up test comes back positive, it means the first round of treatment didn’t fully clear the infection, and a different antibiotic combination will be needed. Resistance to certain antibiotics is increasingly common with H. pylori, which is exactly why confirmation testing exists: you need to know whether the bacteria are truly gone, not just assume treatment worked.