Ranitidine is in a group of medications called histamine-2 blockers. Ranitidine works by reducing the amount of acid your stomach produces. Ranitidine is used to treat and prevent ulcers in the stomach and intestines. It also treats conditions in which the stomach produces too much acid, such as Zollinger-Ellison syndrome. Ranitidine also treats gastroesophageal reflux disease (GERD), and other conditions in which acid backs up from the stomach into the esophagus, causing heartburn.