Stomach ulcers are diagnosed through a combination of your symptoms, a physical exam, and specific medical tests. The gold standard for a definitive diagnosis is an upper endoscopy, where a thin tube with a camera is passed down your throat to look directly at the lining of your stomach. However, doctors often start with less invasive tests for the bacteria that cause most ulcers before they ever schedule an endoscopy.
What Are the First Steps in Diagnosing a Stomach Ulcer?
Your doctor will start by asking about your symptoms and your medical history. Common ulcer symptoms include a burning or gnawing pain in the upper belly, bloating, and feeling full quickly after eating. The pain often comes and goes, and it may be worse when your stomach is empty.
After taking your history, the doctor will press on different areas of your abdomen. This helps check for tenderness and rule out other problems. These first steps are important, but they cannot confirm an ulcer. Many other conditions cause similar pain, including gallstones, acid reflux, and even heart problems. So the physical exam alone is never enough for a diagnosis.
How Are Stomach Ulcers Diagnosed Endoscopy And More?
An upper endoscopy, also called an esophagogastroduodenoscopy or EGD, is the most accurate way to find a stomach ulcer. During this procedure, you are sedated while a doctor guides a flexible tube with a small camera through your mouth, down your esophagus, and into your stomach and the first part of your small intestine.
The camera lets the doctor see the ulcer directly. They can see its size, its shape, and whether it is actively bleeding. During the endoscopy, the doctor can also take small tissue samples, called biopsies. These samples are checked for cancer, for the presence of H. pylori bacteria, and for other conditions that can look like ulcers. Endoscopy is the only test that gives this complete picture.
That said, not everyone with ulcer symptoms needs an endoscopy right away. If you are younger, have no concerning symptoms, and test positive for H. pylori, your doctor may treat the infection first and see if your symptoms improve. Endoscopy is typically reserved for people with warning signs like bleeding, weight loss, difficulty swallowing, or persistent symptoms despite treatment.
What Tests Detect H. pylori Bacteria?
Most stomach ulcers are caused by an infection with Helicobacter pylori (H. pylori). This bacteria damages the protective mucus layer of the stomach, allowing acid to reach the tissue underneath. Finding and treating this infection is a central part of ulcer care.
There are several ways to test for H. pylori. The most common is a breath test. You drink a solution containing a special carbon molecule, and then breathe into a bag. If H. pylori is present, it breaks down the solution and the breath sample shows the marker. This test is simple, painless, and quite accurate.
Another option is a stool antigen test, which checks a stool sample for traces of the bacteria. Blood tests for H. pylori are also available, but they are less reliable. A blood test can show you were infected at some point in your life, but it cannot tell whether the infection is currently active. For this reason, breath and stool tests are generally preferred.
When Is a Barium Swallow X-Ray Used?
Before endoscopy became widely available, a barium swallow X-ray was a standard way to look for ulcers. In this test, you drink a thick, chalky liquid called barium. The barium coats the inside of your stomach and makes it visible on X-ray images. The doctor can then see the outline of the stomach and spot an ulcer as a crater-like defect.
This test is still used in some situations today. It may be chosen when a person cannot safely undergo sedation for an endoscopy. It is also less expensive than an endoscopy. However, a barium swallow is not as accurate. It can miss small or shallow ulcers, and it cannot take tissue samples. If this test shows an ulcer, you will likely still need an endoscopy to get a biopsy and confirm the cause.
What Are the Warning Signs That Require Immediate Care?
Some ulcer symptoms are emergencies. If an ulcer erodes through a blood vessel, it can cause internal bleeding. Signs of bleeding include black, tarry stools, or vomit that looks like coffee grounds. These symptoms require urgent medical attention.
An ulcer can also create a hole in the stomach wall, a condition called perforation. This causes sudden, severe abdominal pain that does not go away. The belly may feel hard and tender to the touch. Perforation is a life-threatening emergency that requires surgery. If you experience these symptoms, do not wait for an office visit. Go to an emergency room immediately.
How Is a Stomach Ulcer Treated After Diagnosis?
Treatment depends on what is causing the ulcer. If H. pylori is found, the standard approach is a combination of antibiotics and a medication called a proton pump inhibitor (PPI) that reduces stomach acid. This regimen is typically taken for 10 to 14 days. Eradicating the bacteria dramatically reduces the chance the ulcer will come back.
If the ulcer is caused by long-term use of nonsteroidal anti-inflammatory drugs (NSAIDs) like ibuprofen or naproxen, the first step is to stop those medications if possible. Your doctor will also prescribe acid-reducing medication to let the ulcer heal. In most cases, ulcers heal within a few weeks to a couple of months with the right treatment.
If the ulcer is not healing or shows unusual features on biopsy, further evaluation is needed. This is why the biopsy taken during endoscopy is so important. It confirms whether the ulcer is benign or whether it contains cancerous cells.
Can Ulcers Be Diagnosed Without Any Tests?
No. A diagnosis based only on symptoms is not reliable. The pain from an ulcer can feel like many other digestive problems. Without a test, there is no way to know for certain whether an ulcer exists, what is causing it, or how serious it is.
Some people try to manage their symptoms with over-the-counter antacids for weeks or months without seeing a doctor. This is risky. If a bleeding ulcer goes unrecognized, it can become a serious emergency. If your symptoms persist for more than a few days or keep coming back, it is worth getting a proper evaluation.
Frequently Asked Questions
Is an endoscopy painful?
No, you are sedated during the procedure and should not feel pain. You may have a mild sore throat afterward for a day or two.
How long does an upper endoscopy take?
The procedure itself usually takes about 15 to 30 minutes. You will need to stay in a recovery area for a short time afterward until the sedation wears off.
Can a stomach ulcer heal on its own without treatment?
Some small ulcers may temporarily improve, but they rarely heal completely without treatment. Without addressing the underlying cause, such as an H. pylori infection or NSAID use, the ulcer is likely to return.
What does an ulcer feel like?
Most people describe a burning or gnawing pain in the upper abdomen, usually between the breastbone and the belly button. The pain may improve briefly after eating or taking antacids, but it often returns.

