Your GP may suspect you have an ulcer based on your symptoms. They'll want to know if you're taking non-steroidal anti-inflammatory drugs (NSAIDs) and may test you for an Helicobacter pylori (H. pylori) infection.
You may be referred to hospital for a procedure to look inside your stomach called a gastroscopy.
If your GP thinks your symptoms may be caused by an H. pylori infection, they may recommend one of the following tests:
If you test positive for H. pylori, you'll need treatment to clear the infection, which can heal the ulcer and prevent it returning.
Read more about treating stomach ulcers.
In some cases, you may be referred for a gastroscopy to look inside your stomach directly and see whether you have a stomach ulcer.
The procedure is carried out in hospital and involves passing a thin, flexible tube (an endoscope) with a camera at one end into your mouth and down into your stomach and the first section of the small intestine (duodenum).
You may be given a mild sedative injection before the procedure and have your throat sprayed with a local anaesthetic to make it more comfortable to pass the endoscope.
The images taken by the camera will usually confirm or rule out an ulcer. A small tissue sample may also be taken from your stomach or duodenum so it can be tested for the H. pylori bacteria.
A gastroscopy is usually carried out as an outpatient procedure, which means you won't have to spend the night in hospital.
Read more about what happens during a gastroscopy.