Antacids are bases, such as CaCO3, Al(OH)3, and Mg(OH)2, that neutralize gastric acid when ingested. They are fast acting but have relatively short duration of effect. Antacids are effective for up to 30 minutes on an empty stomach and neutralize acid for 2 to 3 hours when taken with food. Long-term self-treatment with antacids should be avoided because the cause of excess acid production should be determined. Also, there are more effective treatments.