Heartburn is a sensation of pain or burning that occurs in an individual's esophagus when the acid contents of the stomach come back up into the esophagus. This malfunction occurs when the lower esophageal sphincter fails to keep the stomach's contents from regurgitating into the esophagus. Heartburn is related to bloating because the inappropriate relaxation of the lower esophageal sphincter that results in heartburn can allow an affected individual to swallow more air than they would otherwise. The air passes through the digestive tract and causes the stomach to feel abnormally full.
In addition, a lack of stomach acid production in individuals affected by heartburn-like sensations are a sign the food in their stomach has begun to ferment. This process produces excessive amounts of gas that can cause some of the stomach contents to rise into the esophagus and result in heartburn. This gas may remain trapped when the food eventually does move into the next parts of the individual's gastrointestinal tract and cause further bloating.