How to Get Rid of a Bacterial Stomach Infection

Treating a bacterial stomach infection depends on which bacteria is causing the problem, but the most common culprit, H. pylori, requires a specific course of prescription antibiotics combined with an acid-reducing medication, typically lasting 14 days. Foodborne bacterial infections from contaminated food or water often resolve on their own with supportive care, though severe cases also need antibiotics. Either way, getting the right diagnosis is the essential first step.

H. pylori vs. Foodborne Infections

The phrase “bacterial infection in the stomach” usually refers to one of two things. The first is H. pylori, a slow-burning infection that can live in your stomach lining for years without obvious symptoms. More than half the world’s population carries it at some point, though only about 10% to 15% of those people develop an ulcer. H. pylori spreads through contact with an infected person’s saliva, stool, or vomit, and through contaminated food and water.

The second category includes acute foodborne infections caused by bacteria like Salmonella, E. coli, and Campylobacter. These hit fast, usually within hours to a few days of eating contaminated food, and cause sudden nausea, vomiting, diarrhea, and sometimes fever. Most foodborne infections clear up within a week without antibiotics, while H. pylori never goes away on its own and always requires treatment once diagnosed.

How Bacterial Stomach Infections Are Diagnosed

If your doctor suspects H. pylori, they’ll likely start with one of two non-invasive tests. A urea breath test has you swallow a special substance and then breathe into a collection bag. If H. pylori is present, the bacteria break down the substance in a detectable way. This test picks up about 94% of infections. A stool antigen test, which looks for H. pylori proteins in a stool sample, catches roughly 83% of infections. Blood tests for antibodies are also available but are less accurate and can’t distinguish between a current and past infection.

For foodborne infections, diagnosis usually comes from your symptoms and history of recent food exposure. Stool cultures can identify the specific bacteria if your symptoms are severe or persist beyond a few days.

Antibiotic Treatment for H. pylori

H. pylori requires aggressive treatment because the bacteria are difficult to kill in the acidic stomach environment. Current guidelines from the American College of Gastroenterology recommend a 14-day course of multiple medications taken simultaneously. The preferred first-line option is bismuth quadruple therapy: an acid-reducing medication, bismuth (the active ingredient in Pepto-Bismol), and two antibiotics. This combination works in roughly 90% of cases when followed correctly.

Newer treatment options pair a more powerful acid-blocking drug called vonoprazan with one or two antibiotics, also for 14 days. These regimens were developed partly because antibiotic resistance is a growing problem. Globally, resistance to clarithromycin, one of the most commonly used antibiotics for H. pylori, exceeds 15% in the majority of countries studied. In parts of Asia, resistance rates climb as high as 92%. This is why doctors increasingly favor regimens that don’t rely on clarithromycin unless lab testing confirms the bacteria are susceptible to it.

If your first round of treatment fails, your doctor will switch to a different combination. Salvage regimens for persistent infections have a success rate approaching 70%, so retreatment is common and expected in some cases.

What to Expect During and After Treatment

The 14-day antibiotic course can be demanding. You’ll be taking multiple pills several times a day, and side effects like nausea, metallic taste, diarrhea, and stomach discomfort are common. These side effects are temporary and usually manageable, but they’re also the main reason people stop treatment early, which increases the risk of failure and antibiotic resistance.

Symptoms don’t disappear the moment you finish your pills. It can take weeks to months for stomach irritation and ulcers to fully heal. Your doctor will confirm the bacteria are actually gone by repeating a breath or stool test at least four weeks after you finish antibiotics. This confirmation step is required for all patients because feeling better doesn’t guarantee the infection is cleared.

Probiotics as a Supplement to Treatment

Taking probiotics alongside antibiotics can improve your odds and reduce side effects. A large network meta-analysis found that combining antibiotics with a mix of Bifidobacterium, Lactobacillus, and Saccharomyces strains achieved an eradication rate of 88.2%, with a side-effect rate of only about 17%. By comparison, standard triple therapy alone had notably lower success and higher side-effect rates. Bacillus-based probiotics showed the fewest adverse effects overall, at around 16%.

Probiotics are not a replacement for antibiotics. No probiotic alone can eliminate H. pylori. But adding them to your treatment plan is a low-risk way to support your gut during and after a course of antibiotics, which inevitably disrupts your normal intestinal bacteria along with the target infection.

Managing Foodborne Bacterial Infections

For acute bacterial infections from contaminated food, the priority is staying hydrated. Vomiting and diarrhea can drain fluids and electrolytes quickly. Drink water, broth, or oral rehydration solutions steadily throughout the day. Research from the NIDDK shows that following a restricted diet doesn’t actually help you recover faster, so you don’t need to force yourself onto the classic “BRAT diet” of bananas, rice, applesauce, and toast. When your appetite returns, go back to eating normally.

That said, certain things can make diarrhea worse while you’re recovering: caffeinated drinks, high-fat and fried foods, very sugary beverages, and dairy products. Lactose intolerance can linger for a month or more after a stomach infection, so if milk bothers you during recovery, that’s normal and temporary.

Most foodborne infections resolve within a few days without antibiotics. Your doctor may prescribe them if you have a high fever, bloody diarrhea, or a weakened immune system.

Symptoms That Need Immediate Attention

Most bacterial stomach infections are uncomfortable but not dangerous. However, certain warning signs mean you should get medical help promptly:

  • Bloody diarrhea or vomit that looks like coffee grounds, which can signal bleeding in the stomach or intestines
  • Fever above 102°F (39°C)
  • Inability to keep any liquids down due to persistent vomiting
  • Diarrhea lasting more than three days without improvement
  • Signs of dehydration, including dizziness when standing, very dark urine or barely urinating, and a dry mouth and throat

Black, tarry stools are another red flag, particularly if you have a known or suspected H. pylori infection, because they can indicate a bleeding ulcer.

Preventing Reinfection

H. pylori spreads through person-to-person contact and contaminated food or water. After successful treatment, reinfection rates vary by region but are generally low in developed countries. Consistent handwashing, especially before eating and after using the bathroom, is the most effective prevention. If you live with someone who has tested positive for H. pylori, they should also be tested, since the bacteria pass easily within households.

For foodborne infections, standard food safety practices make the biggest difference: cooking meats to proper temperatures, refrigerating leftovers promptly, washing produce, and avoiding unpasteurized dairy or juice. When traveling to regions with less reliable water treatment, stick to bottled or boiled water and avoid raw fruits and vegetables you can’t peel yourself.