Stomach acid is a type of concentrated hydrocloric acid that is excreted by the stomach lining in response to the ingestion of food. The acid excreted is extremely strong - on par with the potency of acids used in a laboratory. The acid denatures the proteins in food and also acts to break down the chemical bonds in starches, fats and other foods. It also has the positive side effect of killing any bacteria or viruses that may be mixed in with the food. Once the food has reached the required acidity, the bottom of the stomach opens up into the duodenum where alkalines are added back to the food to bring its pH back towards something approximating pure water.
The stomach lining is protected from the acid by a mucous which is also excreted by the stomach lining. However, certain types of acid-loving bacteria, such as heliobacter pylorii, can interfere with the production of mucous, allowing the acid to come in direct contact with the stomach lining. This can lead to gastritis and ulcers.
In most people, the temporary overproduction of acid in response to a large meal, spicy foods or fatty foods can lead to acid splashing up into the esophagus, leading to heartburn, an uncomfortable sensation in the chest. This can usually be treated with antacids - alkaline compounds that neutralize the acid in the stomach. However, in some people, stomach acid regularly splashes into the esophagus (gastro-esophagal reflux disease or acid reflux), which over the long term can lead to damage to the esophagus. This is usually treated with drugs that retard the production of stomach acid, such as proton-pump inhibitors. For temporary relief, foaming agents can be used, which form a barrier between the stomach contents and the esophagus.