Treating certain conditions that cause your body to make too much stomach acid (eg, Zollinger-Ellison syndrome). It is also used to treat ulcers of the small intestine that have not responded to other treatment. It may be used as a short-term alternative to oral ranitidine, in patients who are not able to take medicine by mouth. It may also be used for other conditions as determined by your doctor. Ranitidine is an H2-receptor blocker. It works by blocking the action of histamine in the stomach. This reduces the amount of acid the stomach makes. Reducing stomach acid helps to reduce heartburn, heal irritation of the esophagus, and heal ulcers of the stomach or intestines.