The two main causes of stomach ulcers are a bacterial infection called H. pylori and regular use of common pain relievers like ibuprofen and aspirin. Together, these account for the vast majority of cases. Roughly 27% of ulcer patients have neither cause, a group doctors call “idiopathic” ulcers with no clear explanation.
H. pylori: The Most Common Cause
Helicobacter pylori is a spiral-shaped bacterium that colonizes the stomach lining. About half the world’s population carries it, though most people never develop an ulcer. When H. pylori does cause damage, it uses a two-pronged attack. First, the bacteria produce an enzyme called urease that generates ammonia, which is directly toxic to the cells lining your stomach. Second, the bacteria release enzymes that break down the protective mucus layer coating the stomach wall, essentially stripping away your stomach’s shield against its own acid.
Once that mucus barrier is compromised, stomach acid can reach the delicate tissue underneath and begin eroding it. Over time, this creates an open sore. H. pylori is linked to over 90% of ulcers in the duodenum (the first stretch of the small intestine) and a large share of ulcers in the stomach itself. Prevalence varies enormously by region. Western Sub-Saharan Africa has some of the highest rates of gastrointestinal ulcers globally, at roughly 124 cases per 100,000 people, while Central Latin America has the lowest at about 8 per 100,000.
Pain Relievers That Damage the Stomach
Nonsteroidal anti-inflammatory drugs, commonly called NSAIDs, are the second leading cause of stomach ulcers. This group includes ibuprofen (Advil, Motrin), naproxen (Aleve), and aspirin. These drugs work by blocking enzymes that produce compounds called prostaglandins. While that’s great for reducing pain and inflammation, prostaglandins also do essential maintenance work in the stomach: they stimulate mucus production, promote blood flow to the stomach lining, reduce acid secretion, and help cells repair themselves. When you suppress prostaglandins with regular NSAID use, every one of those protective functions weakens.
The reduced blood flow is especially damaging. Without adequate circulation, the stomach lining can’t deliver nutrients and oxygen needed for tissue repair. Combined with the continued presence of acid and digestive enzymes, the lining develops erosions that can deepen into full ulcers. When researchers examine regular NSAID users with an endoscope, 15% to 30% already have ulcers. Most of these don’t cause noticeable symptoms, but clinically significant problems, including bleeding or severe pain, develop in about 3% to 4.5% of NSAID users.
The risk is highest if you take NSAIDs daily for weeks or months, use high doses, are over 60, or combine them with blood thinners or corticosteroids. Occasional use for a headache carries far less risk than chronic use for arthritis.
Smoking and Alcohol
Neither smoking nor heavy drinking directly causes ulcers the way H. pylori or NSAIDs do, but both make ulcers more likely and significantly harder to heal. Cigarette smoke reduces blood flow to the stomach lining and slows the growth of new blood vessels at the edges of an existing ulcer. In animal studies, smoke exposure measurably delayed ulcer healing by suppressing the production of nitric oxide, a molecule your blood vessels need to stay open and deliver oxygen to injured tissue.
Alcohol in large amounts can irritate and erode the stomach lining, and there is evidence it amplifies the mucosal damage caused by other factors. If you already have an ulcer from H. pylori or NSAIDs, heavy drinking makes the situation worse. Moderate or occasional alcohol use, on the other hand, hasn’t been clearly tied to ulcer formation on its own.
Spicy Food and Emotional Stress Don’t Cause Ulcers
For decades, doctors assumed spicy food and psychological stress were the primary culprits behind stomach ulcers. That theory was debunked in the 1980s after the discovery of H. pylori. There is no evidence that spicy foods cause ulcers or worsen ones that already exist. In fact, capsaicin, the compound that makes peppers hot, may actually stimulate protective mechanisms in the stomach lining. That said, if spicy food causes you discomfort, it’s reasonable to avoid it. The discomfort is real even if the food isn’t causing structural damage.
Emotional stress, like work pressure or anxiety, also does not cause stomach ulcers. However, there is an important distinction: severe physical stress on the body, such as major trauma, burns, organ failure, or time on a ventilator in an ICU, can cause what doctors call “stress ulcers.” These develop because critical illness redirects blood flow away from the digestive tract. The resulting lack of oxygen damages the stomach lining. This is a completely different mechanism from feeling stressed about your job.
Rare Causes Worth Knowing
A small number of stomach ulcers are caused by a condition called Zollinger-Ellison syndrome. In this disorder, tumors called gastrinomas form in the pancreas or small intestine and pump out massive amounts of a hormone called gastrin. Normally your body releases a small amount of gastrin after a meal to signal acid production. Gastrinomas flood the system with gastrin, causing the stomach to produce far more acid than the lining can withstand. The result is severe, recurring ulcers that tend to resist standard treatment. Zollinger-Ellison syndrome is rare, but doctors consider it when ulcers keep coming back despite proper treatment or when ulcers appear in unusual locations.
How Doctors Identify the Cause
Figuring out what’s behind your ulcer matters because the treatment depends entirely on the cause. If H. pylori is responsible, you’ll need a course of antibiotics. If NSAIDs are the problem, stopping or switching the medication is the first step.
Testing for H. pylori can be done several ways. The urea breath test is the most accurate noninvasive option, with a sensitivity around 92% to 94%, meaning it catches the infection in the vast majority of cases. You drink a solution containing a harmless labeled compound, and if H. pylori is present, the bacteria break it down in a way that’s detectable in your breath within minutes. Stool antigen tests are another option, slightly less sensitive at about 83% but widely available in primary care offices. Blood tests for H. pylori antibodies exist but can’t distinguish between a current and past infection, making them less useful for guiding treatment.
When symptoms are severe, when there’s concern about bleeding, or when the ulcer doesn’t respond to initial treatment, doctors typically recommend an endoscopy. A thin flexible camera is passed through your mouth into the stomach, allowing direct visualization of the ulcer and the option to take a small tissue sample for testing. This is considered the gold standard and is especially important for ruling out stomach cancer, which can occasionally mimic an ulcer.
Why Some Ulcers Have No Clear Cause
About 27% of ulcer patients test negative for H. pylori and don’t use NSAIDs. These “idiopathic” ulcers remain poorly understood. Some may be caused by other medications, including certain antidepressants, bisphosphonates used for osteoporosis, or potassium supplements that irritate the stomach lining. Others may reflect undetected low-level H. pylori infections that testing missed, or individual differences in how much protective mucus the stomach produces. Smoking alone may tip the balance in people whose stomachs are already borderline vulnerable.

