Esophagitis is caused by an infection or irritation of the esophagus. Bacteria, viruses, or fungi can cause infection. Individuals with weakened immune systems are more susceptible to these infections and may be at higher risk for esophagitis.Infections that cause esophagitis include:Candida is a yeast infection of the esophagus. In people with weakened immune systems, such as those with diabetes, HIV, those who have transplants or are undergoing chemotherapy, or people who have recently been on antibiotics, the yeast can overgrow in the esophagus, causing inflammation and pain. Candida is treatable with antifungal drugs.Herpes and Cytomegalovirus (CMV) are viral infections that can develop in the esophagus when the body's immune system is weak. It is treatable with antiviral drugs.Irritation of the inner lining of the esophagus may be the cause of esophagitis. Reflux of stomach acid into the esophagus is a common cause of esophageal irritation. This may occur due to several conditions:GERD or gastroesophageal reflux disease: Weakness of the muscle between the stomach and esophagus (lower esophageal sphincter) can allow stomach acid to leak into the esophagus (acid reflux), causing irritation of the inner lining. This is also referred to as GERD esophagitis, and in severe cases it can become erosive esophagitis.Vomiting: Medical conditions that lead to frequent or chronic vomiting can also lead to acid damage to the esophagus. With excessive or forceful vomiting, small tears of the inner wall of the esophagus can occur, leading to further damage.Hernias: A part of the stomach can move above the diaphragm causing a hiatal hernia. This abnormality can lead to excess acid refluxing into the esophagus.Achalasia: This is a disorder where the lower end of the esophagus fails to open normally. As a result food often gets stuck in the esophagus or is regurgitated.Other causes of esophageal irritation can be a result of medical treatment:Surgery: Certain types of bariatric surgery can lead to increased risk of esophagitis.Medications: Aspirin and other anti-inflammatory drugs can irritate the lining of the esophagus. They can also cause increased acid production in the stomach that leads to acid reflux. Large pills taken without enough water, or taken just before bedtime can dissolve or get stuck in the esophagus, causing irritation.Radiation to the chest (thorax), for cancer treatment can cause burns leading to scarring and inflammation of the esophagus.Swallowing foreign or toxic substances can irritate, damage or burn the lining of the esophagus.Drinking alcohol and smoking can also increase the risk of developing esophagitis.When left untreated, inflammation of the esophagus can cause changes in the cells that make up the inner lining (mucosa) of the esophagus. This condition is called Barrett's esophagus, which increases the risk for esophageal cancer.Eosinophilic esophagitis is inflammation of the esophagus due to an over-proliferation of white blood cells (eosinophils) in the lining of the esophageal wall. This leads to dysmotility of the esophagus and difficulty swallowing. It is believed to be associated with different types of allergic reactions in people who are prone to hay fever, rhinitis, and dermatitis, and are more prone to eosinophilic esophagitis.