Stomach ulcers are open sores that form on the inside lining of your stomach. The most common cause is a bacterial infection called Helicobacter pylori (H. pylori), but it is not the only cause. Regular use of certain pain relievers, called NSAIDs, is the other major trigger, and a few less common factors can also play a role.
What Is H. pylori and How Does It Cause Ulcers?
H. pylori is a spiral-shaped bacterium that can live in the harsh, acidic environment of the stomach. It is remarkably common—research suggests that about half of the world’s population carries it, though most people never develop symptoms or ulcers.
The bacteria have clever ways to survive stomach acid. They produce an enzyme called urease that neutralizes acid right around them. They also burrow into the protective mucus layer that lines the stomach wall, which shields them from the most acidic conditions.
Once settled in, H. pylori triggers inflammation in the stomach lining, a condition called gastritis. This inflammation weakens the mucus barrier that normally protects the stomach from its own digestive juices. Over time, the acid and digestive enzymes can reach the stomach tissue itself and create an open sore—the ulcer.
Not everyone infected with H. pylori gets an ulcer. The bacteria are a major risk factor, but genetics, diet, and other lifestyle factors influence whether an ulcer actually forms.
What Other Causes Are There Beyond H. pylori?
If H. pylori is not present, the most likely culprit is a class of pain medications known as nonsteroidal anti-inflammatory drugs, or NSAIDs. This includes common over-the-counter drugs like ibuprofen (Advil, Motrin), naproxen (Aleve), and prescription-strength versions. Aspirin, even in low doses, can also contribute.
NSAIDs work by blocking enzymes called COX-1 and COX-2. The COX-1 enzyme is responsible for producing prostaglandins, which help maintain the protective mucus lining of the stomach. When you block that enzyme, the stomach loses some of its natural defense. The stomach lining becomes more vulnerable to acid damage, and an ulcer can develop.
The risk increases with higher doses and longer durations of use. Taking these medications with food can reduce stomach irritation, but it does not eliminate the ulcer risk entirely.
A less common but serious condition is called Zollinger-Ellison syndrome. In this rare disorder, tumors in the pancreas or duodenum produce excessive amounts of gastrin, a hormone that signals the stomach to produce acid. The resulting acid overload can cause multiple ulcers that are often resistant to standard treatment.
Stress and spicy food are often blamed for ulcers, but the evidence does not support that. They can worsen symptoms of an existing ulcer, but they do not cause one on their own. This is one of the most persistent myths in digestive health.
What Are the Symptoms of a Stomach Ulcer?
The most common symptom is a burning or gnawing pain in the upper abdomen, usually between the breastbone and the belly button. This pain often comes and goes. It may be worse when the stomach is empty and temporarily relieved by eating certain foods or taking antacids.
Some people describe the pain as a dull ache rather than a sharp burn. The discomfort can last from minutes to hours and may occur over several days or weeks.
Not everyone with an ulcer has symptoms. Some ulcers are discovered incidentally during tests for other conditions. When symptoms do appear, they can range from mild to severe.
Certain symptoms require immediate medical attention. These include:
- Vomiting blood, which may look red or like dark coffee grounds
- Black, tarry, or bloody stools
- Sudden, sharp abdominal pain that does not go away
- Unexplained weight loss
- Difficulty swallowing
These signs can indicate bleeding, perforation, or other complications that need urgent care.
How Is a Stomach Ulcer Diagnosed?
If your doctor suspects an ulcer, several tests can confirm the diagnosis. The choice depends on your symptoms, medical history, and what is available.
An upper endoscopy is the most direct method. A thin, flexible tube with a camera is passed through the mouth into the stomach. This allows the doctor to see the ulcer directly and take a small tissue sample, called a biopsy, if needed. The biopsy can confirm the presence of H. pylori and rule out other conditions, including stomach cancer.
For H. pylori detection specifically, several non-invasive tests exist. A urea breath test involves drinking a solution containing a special form of urea. If H. pylori is present, it breaks down the urea and releases carbon dioxide that you exhale, which the test detects. Stool antigen tests look for H. pylori proteins in a stool sample. Blood tests check for antibodies, but they cannot tell the difference between a past and current infection, so they are less useful for confirming an active ulcer cause.
A barium swallow, also called an upper GI series, involves drinking a chalky liquid that coats the stomach and makes it visible on X-rays. This test is less common now because endoscopy is more accurate, but it may be used when endoscopy is not available or appropriate.
How Are Stomach Ulcers Treated?
Treatment depends on the underlying cause. If H. pylori is present, the standard approach is a combination therapy that usually includes two antibiotics and a proton pump inhibitor (PPI), which reduces stomach acid. This combination is sometimes called triple therapy. The goal is to eradicate the bacteria and allow the ulcer to heal.
The antibiotics are typically taken for 10 to 14 days. It is essential to complete the full course even if symptoms improve. Stopping early can allow the bacteria to survive and develop antibiotic resistance.
If NSAIDs are the cause, the first step is to stop taking them if possible. Your doctor can discuss alternative pain management strategies. A PPI or an H2 blocker, another type of acid-reducing medication, is usually prescribed to help the ulcer heal.
For ulcers caused by NSAIDs that cannot be stopped, a medication called misoprostol may be added. It helps protect the stomach lining. Another option is a class of drugs called proton pump inhibitors taken long-term as a preventive measure.
Ulcers caused by Zollinger-Ellison syndrome typically require higher doses of acid-reducing medications. The tumors themselves may need surgical removal or other targeted treatments.
Follow-up testing is important. After completing H. pylori treatment, a breath or stool test is usually repeated to confirm the infection is gone. This is not always done, but it is recommended because treatment failure is possible.
Can Stomach Ulcers Be Prevented?
Prevention strategies focus on the two main causes. If you take NSAIDs regularly, talk to your doctor about whether you need them and at what dose. For some people, acetaminophen may be a safer alternative, though it does not reduce inflammation the way NSAIDs do. If you must take NSAIDs long-term, your doctor may recommend a preventive acid-reducing medication.
There is no vaccine for H. pylori. The bacteria are thought to spread through contaminated food, water, or direct contact with saliva or vomit. Good hygiene practices, such as regular hand washing and safe food handling, may reduce the risk of infection, though the exact transmission route is not fully understood.
Quitting smoking and limiting alcohol intake are reasonable health measures. Smoking slows ulcer healing and increases the risk of recurrence. Alcohol can irritate the stomach lining, though it is not a direct cause of ulcers on its own.
When Should You See a Doctor?
If you have persistent upper abdominal pain that does not resolve with simple measures, seek medical evaluation. Over-the-counter antacids may provide temporary relief, but they do not treat the underlying cause. An ulcer that goes untreated can lead to serious complications, including internal bleeding, perforation of the stomach wall, or blockage of the digestive tract.
Do not assume your pain is just heartburn. Heartburn is a common symptom, but persistent pain in the upper abdomen warrants a proper evaluation. Early diagnosis and treatment can prevent complications and resolve symptoms more quickly.
If you experience any signs of bleeding, such as dark stools or vomiting blood, seek emergency care immediately.
Frequently Asked Questions
Can stress alone cause a stomach ulcer?
No, stress alone does not cause stomach ulcers. It can worsen symptoms of an existing ulcer, but the actual ulcer requires an underlying cause like H. pylori infection or NSAID use.
How long does it take for a stomach ulcer to heal?
With proper treatment, most ulcers heal within 4 to 8 weeks. The timeline depends on the size of the ulcer and whether the underlying cause, such as H. pylori, is effectively eliminated.
Is stomach cancer a risk with H. pylori infection?
H. pylori infection is a known risk factor for certain types of stomach cancer, but the absolute risk is low. Most infected people never develop cancer, though eradication of the bacteria reduces the risk.
Can I drink alcohol while treating a stomach ulcer?
It is best to avoid alcohol during treatment. Alcohol can irritate the stomach lining and may interfere with the healing process, especially while taking antibiotics and acid-reducing medications.

