provider image
Welcome! You’re in GoodRx for healthcare professionals. Now, you’ll enjoy a streamlined experience created specifically for healthcare professionals.
Skip to main content
HomeWell-beingDiet and Nutrition

Having Muscle Cramps? These Foods May Help Keep Them at Bay

Laura M. Ali, MS, RDN, LDNKatie E. Golden, MD
Published on October 1, 2024

Key takeaways:

  • Muscle cramps are common and often affect the calf muscle. Athletes, older adults, and people who’re pregnant are more likely to experience them. 

  • Muscle cramps happen when muscles tense up and aren’t able to relax. There are several potential causes of muscle cramps, but electrolyte imbalance is a common reason.

  • Staying hydrated can help reduce muscle cramps. So can getting enough sodium, potassium, magnesium, and calcium in your diet. 

Close-up of someone spreading avocado on a piece of toast.
Oleksandr Hrytsiv/iStock via Getty Images Plus

You’re drifting off to sleep, when suddenly you wake up with a seizing feeling in your calf muscle. Most people will experience one of these painful cramps at some point in their lives.

Muscle cramps feel like an intense, involuntary contraction in the affected area. Many people say it feels like the muscle is “knotting up” or tightening. 

Muscle cramps can be painful. But they aren’t dangerous, and they usually resolve after a few minutes. Massaging the area can help the muscle to stop contracting. Once the cramp is over, the muscle may still feel sore for a while.

SPECIAL OFFER

Save over 40% on Qsymia with GoodRx

Discover the once daily Qsymia for weight management. Qsymia is for adults and children 12-17 in combination with a healthy diet and regular exercise.

Woman going for a run at sunset
Igor Alecsander/E+ via Getty Images Plus

What causes muscle cramps?

Many factors can contribute to muscle cramping. Let’s walk through some of the more common causes below.

Dehydration and electrolyte imbalance

When your body loses fluids, it also loses key electrolytes, such as:

  • Sodium

  • Potassium

  • Calcium 

  • Magnesium

Your muscles rely on these electrolytes for normal muscle contraction and relaxation. So if any of these get out of balance, abnormal muscle contraction (cramps) can happen.

Dehydration and electrolyte loss aren’t always obvious. They can be caused by:

  • Excessive sweating

  • Prolonged exposure to a hot environment, even without obvious sweating

  • Vomiting

  • Diarrhea

  • Medications, like diuretics

  • Increased urination from diabetes

GoodRx icon
  • Is it a leg cramp — or something more serious? A leg cramp and deep vein thrombosis (DVT) can share similar symptoms. But these clues can help you figure out whether you need medical attention.

  • Drinks that help leg cramps: Replacing electrolytes lost from sweat is one way to help prevent muscle cramps. Here are a few to try.

  • Can you prevent muscle fatigue? Muscle fatigue can be a result of aging or overworking your muscles. But there are ways to improve your muscular endurance.

Tired muscles

Overworking your muscles can cause the communication between your nervous system and muscles to go into overdrive. Muscle cramps often happen during or after intense exercise. But they also sometimes happen at night during sleep. Stretches before and after exercise, massage therapy, and rest may help.

It‘s also important to note that the muscles of older adults can get stressed more easily. This is partly why muscle cramps are more common in people over 50. Older adults may also be more prone to dehydration.

Nutritional deficiencies

Electrolytes aren’t the only nutrients that play a role in muscle contraction. Your muscles also need these vitamins to function properly: 

Most people who eat a balanced diet get enough of these vitamins. But people with medical conditions that affect their nutrition intake or intestinal absorption may be at risk for deficiencies.

Health conditions

Certain health conditions may increase your risk of having muscle cramps, including:

  • Heart conditions, like coronary heart disease

  • High blood pressure

  • Neurological conditions, like Parkinson’s disease

  • Diabetes

  • Pregnancy

These conditions have a direct effect on electrolyte levels. But many of the medications for these conditions can also impact electrolyte levels.

Foods that help with muscle cramps

The following foods provide the vitamins and minerals — and, in some cases, hydration — that may help with muscle cramps. We want to note that there isn’t a lot of research on how individual foods directly impact muscle cramps. So we chose foods that are rich in the electrolytes that help keep your muscles relaxed.

1. Avocados

Avocados are an excellent source of potassium. One Hass avocado has 690 mg of potassium, which is about 15% of the recommended Daily Value (DV). They also contain the electrolyte magnesium.

In addition, avocados contain both copper and pantothenic acid (vitamin B5). Both of these essential nutrients help convert the food you eat into energy.

Half a medium avocado added to a salad or smeared on a slice of bread is a great way to get these healthy nutrients. 

2. Bananas

Bananas contain potassium, which works alongside other electrolytes to maintain your body’s fluid balance. Potassium also plays a role in helping your muscles contract and relax properly. 

A medium banana contains about 420 mg of potassium (12% DV). This is less potassium than foods like avocados or squash. But bananas also have other electrolytes that are important for muscle relaxation, like calcium and magnesium. 

Bananas are also rich in carbohydrates. Carbohydrates are an important energy source, providing the primary fuel your muscles use during exercise. Your muscles store carbohydrates in a form called glycogen. When you exercise heavily, your muscles turn to that stored fuel for energy. 

For these reasons, bananas are a popular post-exercise snack. But don't rely on them to replenish significant drops in your potassium. 

3. Lentils and beans

Lentils and beans contain magnesium, an important electrolyte that helps your muscles properly contract and relax. Magnesium may also help reduce inflammation in your muscles after exercise. 

One cup of cooked lentils contains 16% DV, while beans contain 13% DV. Both are excellent choices for getting magnesium into your daily diet. 

Incorporating beans and lentils into your diet is as simple as tossing some into a salad. You can also add them to a casserole or soup.

4. Sweet potatoes

Sweet potatoes are an excellent source of potassium, calcium, and magnesium. 

Sweet potatoes also contain antioxidants. These help prevent the inflammation that can happen when muscles are exercised or fatigued. 

Muscle exertion creates something called oxidative stress. Oxidative stress can lead to muscle atrophy and protein loss. But eating foods that are rich in antioxidants can reduce the effects of oxidative stress on muscle tissue.

Toss roasted sweet potatoes with broccoli and carrots for a tasty side dish. Or puree them and mix them into your morning oatmeal, pancake batter, or smoothie. 

5. Melon

Melon contains electrolytes that can reduce the risk of muscle cramps. It’s also loaded with water to hydrate muscles. Both cantaloupe and watermelon are about 90% water. 

Melon contains lots of vitamin C, an antioxidant, which may help muscle function by: 

A cup of cantaloupe has 57 mg of vitamin C (95% DV). One cup of watermelon contains 12 mg of vitamin C (20% DV). 

Add watermelon or cantaloupe cubes to your salad or morning smoothie. 

6. Leafy greens

Eating leafy greens is a great way to ensure you get various nutrients in your diet, particularly magnesium. 

You can choose from a variety of leafy greens for your meals. They’re all excellent sources of these nutrients. 

1 cup cooked spinach

1 cup cooked Swiss chard

1 cup cooked beet greens

157 mg magnesium (37% DV)

150 mg magnesium (36% DV)

98 mg magnesium (23% DV)

839 mg potassium (18% DV)

961 mg potassium (20% DV)

1,310 mg potassium (28% DV)

245 mg calcium (19% DV)

102 mg calcium (8% DV) 

164 mg calcium (12.5% DV)

A bonus is that leafy greens are low in calories and fiber-rich. Add some to your salads or a sandwich, or blend them into your morning smoothie.

7. Yogurt and milk

Dairy products contain potassium and calcium, both critical for muscle contraction. Dairy is also a great source of protein, which can help repair muscle tissue after exercise. Drinking a glass of milk after heavy exercise is often recommended to help with muscle recovery. Milk also helps with hydration. 

8. Bone broth

Bone broth is rich in amino acids and minerals that are important for muscle health. And since it is a liquid, it can also help with hydration. 

The bones used to prepare bone broth contain calcium and magnesium. The amounts of calcium and magnesium vary depending on the preparation method and how long the bones cook. Adding some salt for flavor boosts the sodium content. 

You can use bone broth as a base for soups, or to cook rice or other grains. Some people even drink it like tea.

9. Seafood

Seafood can be a great source of beneficial nutrients for muscle health. In particular, salmon, trout, and sardines are rich in:

  • Protein

  • B vitamins

  • Iron

  • Potassium

Together, these nutrients are important for muscle contraction and relaxation, strength, and recovery. 

In addition, some seafood also contains selenium. Low levels of selenium have been linked to muscle weakness in older people. Other research suggests that selenium’s antioxidant properties may help reduce damage to muscle cells.

Excellent seafood sources of selenium include:

Seafood also contains omega-3 fatty acids. They can help reduce inflammation in muscles following exercise. Omega-3s also help clear arteries of plaque buildup. This ensures adequate blood flow, as well as the proper delivery of oxygen and nutrients to your muscles. 

Most health agencies recommend eating two servings of seafood a week. Enjoy a grilled salmon filet for dinner, a pouch of tuna after a workout, or add cooked shrimp to a stir fry or soup. 

10. Pickles

When exercise causes excessive sweating, some athletes drink pickle juice as a way to replenish their fluids and electrolytes. This is because pickle juice contains both water and sodium, which work together to replenish fluid balance. 

But drinking pickle juice hasn’t been shown to significantly affect sodium and potassium concentration after heavy exercise. It may actually be dehydrating because of the high sodium content. Still, enjoying a few pickles on a sandwich can add some extra sodium to your meal, which may help with muscle recovery after a workout. 

The bottom line

There’s no research on the best foods to eat for muscle cramps. But experts do know that significant changes in electrolytes can cause muscle cramps. And a nutrient-rich diet is an important part of keeping your electrolytes balanced. Choosing foods that provide minerals like potassium, magnesium, and calcium will help your muscles contract and relax properly. Sodium, in moderation, also helps. Finally, stay hydrated, and stretch before and after intense exercise to help prevent muscle cramps.

why trust our exports reliability shield

Why trust our experts?

Laura M. Ali, MS, RDN, LDN
Laura is an award-winning registered dietitian and certified culinary nutritionist with over 30 years of experience. She spent the first half of her career working in clinical nutrition, helping clients manage their health through diet.
Meredith Hoffa
Edited by:
Meredith Hoffa
Meredith Hoffa is a senior health editor at GoodRx, where she leads journalists and clinicians covering various well-being topics, particularly in diet and nutrition.
Katie E. Golden, MD
Katie E. Golden, MD, is a board-certified emergency medicine physician and a medical editor at GoodRx.

References

American Heart Association. (2021). Fish and omega-3 fatty acids

American Pregnancy Association. (n.d.). Leg cramps during pregnancy

View All References (28)

Bergeron, M. F. (2008). Muscle cramps during exercise-is it fatigue or electrolyte deficit? Current Sports Medicine Reports

Bordoni, B., et al. (2023). Muscle cramps. StatPearls

Fernández-Lázaro, D., et al. (2020). The role of selenium mineral trace element in exercise: Antioxidant defense system, muscle performance, hormone response, and athletic performance. A systematic review. Nutrients

Grandner, M. A., et al. (2017). Nocturnal leg cramps: Prevalence and associations with demographics, sleep disturbance symptoms, medical conditions, and cardiometabolic risk factors. Public Library of Science One

Gröber, U., et al. (2015). Magnesium in prevention and therapy. Nutrients

Jahic, D., et al. (2018). Exercise-associated muscle cramp-doubts about the cause. Materia Socio Medica

James, L. K., et al. (2019). Cow's milk as a post-exercise recovery drink: Implications for performance and health. European Journal of Sport Science

Jouris, K. B., et al. (2011). The effect of omega-3 fatty acid supplementation on the inflammatory response to eccentric strength exercise. Journal of Sports Science and Medicine

Lauretani, F., et al. (2007). Association of low plasma selenium concentrations with poor muscle strength in older community-dwelling adults: The InCHIANTI Study. American Journal of Clinical Nutrition

McKenney, M. A., et al. (2015). Plasma and electrolyte changes in exercising humans after ingestion of multiple boluses of pickle juice. Journal of Athletic Training

Miller, K. C., et al. (2012). Plasma potassium concentration and content changes after banana ingestion in exercised men. Journal of Athletic Training

Murray, B., et al. (2018). Fundamentals of glycogen metabolism for coaches and athletes. Nutrition Reviews

National Institutes of Health. (2022). Potassium

National Institutes of Health. (2023). Thiamin

Ranchordas, M. K., et al. (2017). Antioxidants for preventing and reducing muscle soreness after exercise. Cochrane Database of Systematic Reviews

Richards, J. C., et al. (2015). Acute ascorbic acid ingestion increases skeletal muscle blood flow and oxygen consumption via local vasodilation during graded handgrip exercise in older adults. American Journal of Physiology Heart and Circulatory Physiology.

Souza, A. C. R., et al. (2023). The integral role of magnesium in muscle integrity and aging: A comprehensive review. Nutrients

Steinbacher, P., et al. (2015). Impact of oxidative stress on exercising skeletal muscle. Biomolecules

U.S. Department of Agriculture. (2019). Bananas, raw

U.S. Department of Agriculture. (2019). Crustaceans, shrimp, mixed species, cooked, moist heat (may contain additives to retain moisture)

U.S. Department of Agriculture. (2019). Fish, salmon, Atlantic, wild, raw

U.S. Department of Agriculture. (2019). Fish, salmon, chinook, cooked, dry heat

U.S. Department of Agriculture. (2019). Fish, sardine, Atlantic, canned in oil, drained solids with bone

U.S. Department of Agriculture. (2019). Fish, trout, rainbow, farmed, raw

U.S. Department of Agriculture. (2019). Fish, tuna, skipjack, fresh, cooked, dry heat

U.S. Department of Agriculture. (2019). Melons, cantaloupe, raw

U.S. Department of Agriculture. (2019). Watermelon, raw

Young, G. (2015). Leg cramps. British Medical Journal Clinical Evidence.

GoodRx Health has strict sourcing policies and relies on primary sources such as medical organizations, governmental agencies, academic institutions, and peer-reviewed scientific journals. Learn more about how we ensure our content is accurate, thorough, and unbiased by reading our editorial guidelines.

Was this page helpful?

Best Foods For A Healthy Weight!

Sign up for our GoodRx Diet and Nutrition Newsletter to receive the latest healthy eating advice, recipes, and savings that are most relevant to you.

By signing up, I agree to GoodRx's Terms and Privacy Policy, and to receive marketing messages from GoodRx.