How to Treat Heartburn With Meds

Medically Reviewed by Melinda Ratini, MS, DO on July 02, 2026

The acid that helps digest food is very strong. But while your stomach can handle it, the more sensitive esophagus can’t.

Stomach acid is supposed to stay in your stomach. But if a faulty valve at the top of your stomach is leaky, acid can wash (or “reflux”) up, causing a burning sensation called heartburn, which has nothing to do with your heart.

Ideally, you can reduce reflux symptoms simply by losing weight or changing your habits-like not lying down within 2 hours of eating. If you are not getting relief, there are plenty of over-the-counter and prescription medicines that can help cool the burn.

Before you choose one, get to know the options. And keep in mind that sometimes what you think is heartburn is something else. So before you start any heartburn treatment, it’s best to see a doctor to rule out other issues.

The oldest and best-known medicines for treating heartburn, they have remained popular because they’re fast-acting, inexpensive, available without a prescription, and are safe for most people when used as directed. Maalox, Mylanta, Rolaids, and Tums are examples.

How do they work? Antacids neutralize acids in the stomach (think: anti-acid). You can take them to treat heartburn that has already started. If you ate a spicy dinner and have heartburn symptoms, antacids are probably your best bet to put out that fire.

Some are tablets. Others are sold as liquids. Tablets take longer to act and aren’t as strong as the liquid, but many people find the tablets to be more convenient. For faster relief, chew them well before swallowing.

How soon do they take effect? They can start to ease your symptoms in as little as 5 minutes. The relief may last as little as half an hour or as long as 3 hours. Antacids won’t prevent future bouts of heartburn or heal any damage in your esophagus.

Side effects: Your side effects may depend on how much you take and how often you take them. If you only take them every now and then, you may not have any. But some people who use antacids may get diarrhea or constipation. Antacids that contain calcium carbonate or aluminum tend to cause more constipation. Those that contain magnesium tend to cause more diarrhea. If you have heart or kidney problems, you should talk to your doctor before taking any of them.

The bottom line: If your heartburn is mild and due to something you ate, an antacid is probably your best option. It will work quickly, and there’s little downside. But if your heartburn is more severe, or it happens more than twice a week, you may need a stronger medicine.

If antacids don’t help enough, you may want to consider a histamine blocker (H2 blocker). H2 blockers like cimetidine (Tagamet), famotidine (Pepcid), and nizatidine (Axid) are available in liquids and tablets, both over-the-counter and by prescription.

How do they work? These drugs tell your stomach to make less acid, so you are less likely to get heartburn.

If you tend to get heartburn in certain situations, like when you eat spicy food, taking an H2 blocker an hour before your meal can help ward off symptoms. When taken before bed, they can help with nighttime heartburn.

How soon do they take effect? Usually, they start to work in an hour and the results last for up to 12 hours. One medicine, Pepcid Complete, combines two antacids (calcium carbonate and magnesium hydroxide) with an H2 blocker (famotidine) for both immediate and longer-term relief.

H2 blockers are not always effective against chronic heartburn caused by gastroesophageal reflux disease (GERD).

You can take over-the-counter H2 blockers for up to 2 weeks for short-term help. If you have used over-the-counter medicines to treat your symptoms for longer than that, talk to your doctor.

Side effects can include diarrhea, constipation, dizziness, and sleepiness.

The bottom line: H2 blockers can be an effective treatment against moderate cases of heartburn. One of their advantages is that they can be taken as needed and don't need to be taken daily to work. You can also take them before a meal to help prevent symptoms. But if you have a severe case or your symptoms are not relieved after two weeks of twice daily H2 blockers, you'll likely need a stronger medication.

If antacids and H2 blockers don’t give you enough relief, or if you have heartburn often or your reflux is severe, you may want to try another type of drug called a proton pump inhibitor (PPI).

PPIs include over-the-counter and prescription pills and capsules. No formulation has been shown to be better than any other, but you may find one that is more effective for your symptoms.

Over-the-counter medications include esomeprazole (Nexium 24 HR), lansoprazole (Prevacid OTC), omeprazole (Prilosec), and omeprazole/sodium bicarbonate (Zegerid OTC).

Medications that your doctor can prescribe include dexlansoprazole (Dexilant), esomeprazole (Nexium), lansoprazole (Prevacid 24HR), omeprazole (Prilosec), omeprazole/sodium bicarbonate (Konvomep, Zegerid), pantoprazole (Protonix), and rabeprazole (Aciphex).

How do they work? In your stomach, millions of tiny pumps make acid to break down food. PPIs turn off some of these pumps. The result is less stomach acid. PPIs can heal an inflamed esophagus or an ulcer.

How soon do they take effect? Some people expect PPIs to help right away. But they can take up to 4 days of daily use to start working. Unlike H2 blockers, PPIs are meant to be taken every day for at least 2 weeks. Sometimes your doctor might prescribe a 4- to 8-week course, and some patients find they need them indefinitely. All of the PPIs work best when taken on an empty stomach 30 minutes prior to breakfast , even if your worst symptoms are at night.

Side effects: There are a number of potential side effects from taking PPIs long term, but study data is weak. There is a concern for diarrheal infections and pneumonia. The low acid state can affect the absorption of multiple vitamins and minerals, leading to low iron, magnesium, calcium, and vitamin B12 levels. Low bone density leading to an increased risk of fracture, such as breaking a hip, is also a concern.

When you suddenly stop taking PPIs, your body may produce an overabundance of acid before settling back down to its normal. It may take up to two weeks before your body returns to its normal. It is best to gradually stop the use of PPIs.

Your doctor may also prescribe vonoprazan (Voquezna),  which is in a new class of medicines called potassium-competitive acid blockers (PCAB). This medicine also works at the proton pump level to decrease the acid in your stomach.

The bottom line: These medications can help get heartburn under control, but if you find yourself taking them often because your symptoms are severe or keep coming back, then it’s time to talk to your doctor.

In 2023, the Food and Drug Administration (FDA) approved the first in a new class of medicines to treat GERD - vonoprazan (Voquenza). This newer medicine can be an option when PPIs are not desired or aren’t working well enough. It is only available by prescription.

How does it work?

Known as a potassium-competitive acid blocker (PCAB), it turns down the secretion of acid in your stomach both in the absence and presence of food. It is usually prescribed for daily use for 4 weeks, or longer if there is significant damage to your esophagus. Like PPIs, it can heal an inflamed esophagus or ulcer.

How soon does it take effect?

Vonoprazan can start to decrease stomach acid within 1 to 3 hours of the first dose. But its full effects won’t be seen for about 4 days. It can be taken with or without food.

Side effects:

The most common side effects are stomach pain, diarrhea, nausea, and bloating. There are concerns about diarrheal infections. The low stomach acid state can reduce your absorption of nutrients like vitamin B12 and magnesium, which can also lead to low calcium or potassium. There is also a concern about bone fractures with long-term use.

The bottom line:

Vonoprazan is the newest medicine in your doctor’s arsenal against serious stomach acid problems. It may help even when you have tried other options or when they are not right for you

Add WebMD as a Preferred Source to see more of our trusted content across Google Search, AI Overviews, and AI Mode