Stomach ulcers are usually caused by Helicobacter pylori (H. pylori) bacteria or non-steroidal anti-inflammatory drugs (NSAIDs).
These can break down the stomach's defence against the acid it produces to digest food, allowing the stomach lining to become damaged and an ulcer to form.
H. pylori bacteria
H. pylori infections are common, and it's possible to be infected without realising it because the infection doesn't usually cause symptoms.
The bacteria live in the stomach lining, and people of all ages can be infected.
But in some people, the bacteria can irritate the stomach lining and make it more vulnerable to damage from the stomach acid.
It's not clear exactly why some people are more vulnerable to the effects of H. pylori bacteria than others.
NSAIDs are medicines widely used to treat pain, a high temperature (fever) and inflammation (swelling).
Commonly used NSAIDs include:
Many people take NSAIDs without having any side effects, but there's always a risk the medication could cause problems, such as stomach ulcers, particularly if taken for a long time or at high doses.
You may be advised not to use NSAIDs if you currently have a stomach ulcer or if you have had one in the past.
Paracetamol can often be used as an alternative painkiller, as it's generally considered safer.
It used to be thought that stomach ulcers may be caused by certain lifestyle factors, such as spicy foods, stress and alcohol.
There's little hard evidence to confirm that this is the case, but these factors may make the symptoms of ulcers worse.
But it's thought that smoking increases your risk of developing stomach ulcers and may make treatment less effective.