How Do You Get a Stomach Ulcer: Causes & Treatment

Most stomach ulcers are caused by H. pylori bacteria or painkiller use, not stress. Learn the real causes, symptoms, and treatment options.

Most stomach ulcers are caused by one of two things: infection with a bacterium called Helicobacter pylori or regular use of common painkillers like ibuprofen and aspirin. Together, these two culprits account for the vast majority of peptic ulcer disease, which affects roughly five to ten percent of people worldwide at some point in their lives. The story behind how each one damages the stomach lining, how doctors figure out which is responsible, and what treatment actually looks like is more layered than most people expect.

What H. pylori Does to Your Stomach

H. pylori is a spiral-shaped bacterium that burrows into the mucus layer lining your stomach and sets up permanent residence. About half the world’s population carries it, though only a fraction develop ulcers. The bacterium damages the stomach wall through several mechanisms at once. It produces a toxin called vacuolating cytotoxin that causes visible damage to the cells lining the stomach. It also churns out the enzyme urease, which produces ammonia as a byproduct, and that ammonia is itself toxic to gastric cells. Over time, the chronic inflammation this causes weakens the protective mucus barrier and leaves patches of stomach lining exposed to digestive acid.

The pattern of inflammation matters. When H. pylori causes widespread inflammation mostly in the lower part of the stomach (the antrum), people tend to develop duodenal ulcers. When the inflammation extends higher into the body of the stomach and causes tissue to thin out (atrophy), gastric ulcers and even stomach cancer become more likely. This distinction helps explain why two people carrying the same bacterium can end up with very different problems.

The discovery that a bacterium could cause ulcers was one of the great upsets in modern medicine. Before Barry Marshall and Robin Warren identified H. pylori in 1982, the medical establishment blamed ulcers almost entirely on stress and diet. Marshall famously drank a broth of the bacteria to prove his point. The two eventually won the Nobel Prize for their work.

How Painkillers Cause Ulcers

Nonsteroidal anti-inflammatory drugs, known as NSAIDs, are the other major cause. This group includes over-the-counter staples like ibuprofen, naproxen, and aspirin, along with prescription versions like indomethacin and diclofenac. Occasional use is generally safe for most people, but chronic use poses a real risk. NSAIDs work by blocking enzymes called cyclooxygenases (COX), which are involved in producing prostaglandins. Prostaglandins sound obscure, but they play a central role in keeping the stomach lining healthy: they help maintain the mucus coating, promote blood flow to the stomach wall, and regulate acid secretion. Block prostaglandin production, and you strip away those protections.

The damage isn’t purely chemical. Research has shown that NSAIDs, at doses that suppress prostaglandin production, also trigger abnormal increases in stomach motility. This heightened contracting and churning of the stomach appears to be one of the earliest events in NSAID-related injury, occurring even before the mucus barrier visibly breaks down. It leads to increased permeability of the lining, infiltration of inflammatory cells, and eventually tissue erosion. So the process is a cascade: prostaglandin loss triggers hyperactive stomach movement, which weakens the barrier, which lets acid attack the exposed tissue.

Stress, Spicy Food, and Other Myths

The old belief that stress “gives you an ulcer” is overly simple but not completely wrong. Chronic psychological stress does not, by itself, bore a hole through your stomach lining. But unhealthy lifestyle habits, poor stress management, smoking, heavy alcohol use, and inadequate sleep have all been closely linked with peptic ulcer disease and with slower healing of existing ulcers. Smoking is a particularly clear-cut risk factor: it impairs blood flow to the stomach lining and slows healing. Alcohol in excess damages the mucus barrier directly.

Spicy food, meanwhile, gets blamed almost reflexively for ulcers. There is no strong evidence that eating spicy food causes ulcers in a healthy stomach. Capsaicin, the compound that makes peppers hot, can irritate an existing ulcer and make symptoms worse, but it does not create one. The confusion persists partly because the burning sensation from spicy food feels similar to ulcer pain, and partly because the “stress and diet” theory of ulcers dominated medicine for most of the twentieth century.

Less Common Causes

Outside of H. pylori and NSAIDs, a handful of rarer conditions can produce ulcers. One worth knowing about is Zollinger-Ellison syndrome, a condition in which tumors called gastrinomas form in the pancreas or duodenum. These tumors pump out massive amounts of the hormone gastrin, driving the stomach to produce far more acid than normal. The result is severe, recurrent peptic ulcers along with chronic diarrhea and acid reflux that resist standard treatment. Zollinger-Ellison is rare, but it tends to be the answer when ulcers keep coming back despite correct treatment and when H. pylori tests are negative.

Critically ill patients in hospitals can also develop what are called stress ulcers, though the word “stress” here means physiological stress from severe injury, sepsis, or organ failure rather than everyday anxiety. These lesions develop because of reduced blood flow to the stomach lining and a breakdown of defensive mechanisms during critical illness. The major risk factors are prolonged mechanical ventilation and clotting disorders. Prevention with acid-suppressing medication is routine in intensive care settings.

How Ulcers Are Diagnosed

If you go to the doctor with gnawing upper abdominal pain, especially pain that gets worse on an empty stomach or wakes you at night, ulcer disease is high on the list of suspects. The gold standard for confirming it is an upper endoscopy, where a thin camera is passed down the throat into the stomach. This lets the doctor see the ulcer directly and take tissue samples to check for H. pylori and to rule out cancer.

Not everyone needs an endoscopy, though. For younger patients without alarm symptoms like weight loss or bleeding, doctors often start by testing for H. pylori non-invasively. The urea breath test is widely recommended as the first-choice non-invasive option because of its high accuracy, quick results, and simplicity. Stool antigen tests and blood antibody tests are also available. The breath test works after treatment too, to confirm the infection has been cleared.

Treating the Infection

When H. pylori is the cause, killing the bacterium is the single most important step. Standard treatment combines two or three antibiotics with an acid-suppressing drug, taken for one to two weeks. The specific combination your doctor chooses depends on local resistance patterns, which vary widely around the world. Clarithromycin resistance has become a serious problem globally: when the bacterium is resistant to clarithromycin, standard triple therapy fails far more often.

Bismuth-based quadruple therapy, which includes bismuth, two antibiotics, and an acid suppressor, is an effective alternative. A systematic review found it consistently eradicates more than eighty percent of infections, though its side-effect profile can limit tolerability for some patients. Newer regimens using vonoprazan, a more potent acid blocker, in combination with antibiotics have shown strong eradication rates with better tolerability. High-dose amoxicillin-based regimens are also gaining attention as a safer option, particularly in areas where clarithromycin resistance is common.

Treatment duration matters. In one study comparing regimens, a levofloxacin-based triple therapy given for only seven days had a dismal success rate compared to quadruple therapy, but extending the same regimen to fourteen days brought its success rate up to roughly the same level. The lesson: cutting antibiotic courses short dramatically reduces the odds of curing the infection.

Acid Suppression and Healing

Whether or not H. pylori is involved, suppressing stomach acid is essential for giving the ulcer time to heal. Proton pump inhibitors (PPIs) like omeprazole, lansoprazole, and pantoprazole are the workhorses here. They block the final step of acid production and keep the stomach’s pH elevated for most of the day. Compared to the older class of acid blockers, H2 receptor antagonists (such as ranitidine and famotidine), PPIs maintain a less acidic environment for roughly fifteen to twenty-two hours per day, versus around four hours for H2 blockers.

That extended acid suppression translates into faster healing. PPIs are associated with more rapid and stronger ulcer repair, particularly in the early weeks of treatment. For bleeding ulcers specifically, PPIs cut the rate of persistent or recurrent bleeding roughly in half compared to H2 blockers. That said, the advantage in reducing the need for emergency surgery or overall mortality is less clear-cut.

PPIs are not perfect drugs. They take two to three days to reach their maximum effect, they need to be taken on an empty stomach before a meal for best results, and their effectiveness can vary based on how your body metabolizes them. A newer class of acid blockers called potassium-competitive acid blockers (P-CABs), with vonoprazan as the leading example, addresses several of these shortcomings. P-CABs act faster, don’t require food timing, and work regardless of your metabolic profile. They are becoming more widely available, though PPIs remain the global standard for now.

What Happens If an Ulcer Goes Untreated

An ulcer that is left to fester can lead to serious, life-threatening complications. The most common is bleeding, which occurs when the ulcer erodes into a blood vessel. You might notice it as dark, tarry stools or vomiting material that looks like coffee grounds. The annual rate of ulcer-related bleeding in the general population is low in absolute terms, but the consequences are severe: thirty-day mortality from a bleeding ulcer averages around eight to nine percent.

Perforation, where the ulcer burns completely through the stomach or duodenal wall, is less common, occurring at a ratio of roughly one perforation for every six bleeding episodes. But it is far more dangerous: thirty-day mortality averages about twenty-four percent. Perforation is the most common reason for emergency ulcer surgery and accounts for about forty percent of all ulcer-related deaths. A third complication, gastric outlet obstruction from chronic scarring, used to be a significant concern but has become rare with modern medical management.

Protecting Your Stomach If You Need Painkillers

Millions of people take NSAIDs daily for arthritis, chronic pain, or heart disease prevention (low-dose aspirin). If you cannot avoid them, the standard protective strategy is to take a PPI alongside your NSAID. This combination is included in most prescribing guidelines and has proven effective at reducing the risk of ulcers in people on chronic NSAID therapy. PPIs can both heal NSAID-associated ulcers and prevent new ones from forming, even when the patient keeps taking the NSAID.

For people at the highest risk, meaning those with a history of ulcer bleeding, the safest strategy appears to be combining a COX-2 selective NSAID (like celecoxib, which is less damaging to the stomach than traditional NSAIDs) with a PPI. A Cochrane review found that this combination offers the greatest gastrointestinal safety in high-risk patients. Using a COX-2 inhibitor alone provides protection roughly equal to taking a traditional NSAID with a PPI, but re-bleeding rates with either strategy alone remain relatively high in high-risk patients.

One older protective drug, sucralfate, coats the stomach lining physically but has not been found effective at preventing NSAID ulcers. In a head-to-head trial, the prostaglandin analog misoprostol was significantly better at the job. Misoprostol works, but it causes diarrhea and cramping frequently enough that many patients and doctors prefer PPIs instead.

The Cancer Connection

One reason doctors take H. pylori infection seriously, beyond ulcers themselves, is the link to stomach cancer. H. pylori is the strongest known risk factor for gastric cancer. A large Japanese study followed over 1,500 patients for years and found that gastric cancers developed in about three percent of infected patients and in none of the uninfected ones. Among infected patients, the risk was highest in those with severe gastric atrophy and intestinal metaplasia, a precancerous tissue change. Patients with gastric ulcers had a higher cancer rate than those with duodenal ulcers, who had the lowest rate in the study.

This connection is one of the strongest arguments for testing and treating H. pylori even in people whose ulcer symptoms seem mild. Eradicating the infection may reduce long-term cancer risk, particularly when treatment happens before advanced atrophy has set in. The bacterium has also been linked to a rare type of lymphoma called MALT lymphoma, which in early stages can sometimes be cured by antibiotic treatment alone.

Why Some People Get Ulcers and Others Don’t

If half the world carries H. pylori but only a small fraction gets ulcers, something else must be tipping the balance. Part of the answer lies in the bacterial strain. Some strains of H. pylori produce more of the damaging toxins than others. But host genetics play a role too. Your immune system’s response to the infection, governed partly by variations in genes for inflammatory signaling molecules, helps determine whether the infection stays quiet or causes real damage.

Certain variants of the genes for interleukin-1B and the interleukin-1 receptor antagonist, both involved in regulating inflammation, have been associated with increased risk of peptic ulcers and gastric cancer in people who are infected with H. pylori. A meta-analysis found that specific variations in the interleukin-8 gene were linked to a meaningfully higher risk of developing H. pylori-related peptic ulcer disease. Separately, carriers of a particular interleukin-1B variant showed roughly a threefold increased risk of peptic ulcer compared to non-carriers.

This genetic dimension explains why ulcer disease runs in some families and why identical exposures produce different outcomes in different people. It’s not something you can change, but it underscores the importance of testing for and treating H. pylori if you have a family history of ulcers or stomach cancer.

Probiotics as a Treatment Sidekick

Probiotics have attracted increasing attention as add-ons to standard H. pylori eradication therapy. They do not replace antibiotics, but taking them alongside the standard regimen appears to improve cure rates and reduce side effects, particularly antibiotic-associated diarrhea. An umbrella review of multiple meta-analyses found that adding probiotics to standard therapy was associated with about a ten percent relative improvement in eradication rates and roughly halved the risk of side effects like diarrhea and nausea.

The benefit seems to come from several mechanisms: probiotics compete with H. pylori for space on the stomach lining, boost mucus production, produce antimicrobial substances, and help modulate the immune response. Both single-strain and multi-strain preparations appear to help. The evidence is encouraging enough that some gastroenterologists now routinely recommend probiotic supplementation during H. pylori treatment, though it has not yet become universal in formal guidelines. If you are prescribed an eradication regimen, asking your doctor about adding a probiotic is a reasonable conversation to have.