Foods High in Magnesium for Leg Cramps with pumpkin seeds, almonds, spinach, beans, oats, banana, yogurt, salmon, and water.

Foods High in Magnesium for Leg Cramps: A Safe Food First Guide

Published: Nov 1, 2023

Last updated: July 18, 2026

Next review: July 2027

Written by: Adel Galal, Founder and Lead Writer at NextFitLife

Editorial review: Updated and checked against current public health guidance

Medical review status: This article has not been medically reviewed by a doctor or registered dietitian

Reading time: About 17 minutes

Foods High in Magnesium for Leg Cramps may help you meet your daily magnesium needs. This mineral supports normal muscle and nerve function.

However, magnesium is not a sure cure for leg cramps.

A serious magnesium shortage can cause muscle cramps. Yet most common leg cramps are caused by something else. Exercise, muscle strain, pregnancy, aging, dehydration, medicine, poor blood flow, and nerve problems may all play a role.

Research also shows that magnesium supplements are unlikely to prevent common muscle cramps in many older adults.

This does not make magnesium foods useless. Pumpkin seeds, beans, spinach, nuts, whole grains, and other foods provide magnesium along with fibre, protein, vitamins, and other minerals.

This guide explains the best food sources, how much magnesium adults need, what else may cause cramps, and when to seek medical care.

For a wider look at this mineral, read the NextFitLife guide to foods that contain magnesium.

Important Medical Note

I am not a dermatologist or a doctor. I am also not a neurologist, pharmacist, registered dietitian, physical therapist, or sports medicine specialist.

This content does not replace professional medical advice. What I share comes from real-life experience with healthy eating and daily wellness, extensive research, and consultation with healthcare providers.

Always consult qualified medical professionals for diagnosis and treatment of any health condition.

Do not stop medicine, take large mineral doses, or assume every leg cramp is caused by low magnesium because of this article.

Quick Answer: Can Foods High in Magnesium Help with Leg Cramps?

Foods high in magnesium for leg cramps can help when your normal diet is low in magnesium. They may also help correct a low intake over time.

They will not stop every cramp.

The best food choices include:

  • Pumpkin seeds
  • Chia seeds
  • Almonds
  • Spinach
  • Cashews
  • Peanuts
  • Black beans
  • Edamame
  • Peanut butter
  • Potatoes with the skin
  • Brown rice
  • Plain yogurt
  • Oats
  • Kidney beans
  • Bananas
  • Whole wheat bread
  • Avocado
  • Salmon

Add these foods as part of a balanced eating pattern.

Also, drink enough fluid, stretch the affected muscle, review your exercise routine, and speak with a healthcare professional when cramps are frequent or severe.

What is a leg cramp?

A leg cramp is a sudden tightening of a muscle.

It can cause severe pain and make the leg hard to move.

Cramps often affect the calf. They can also affect the feet or thighs.

A cramp may last for a few seconds or several minutes. The muscle may remain sore after it relaxes.

Night leg cramps often happen while a person is resting or sleeping.

A cramp is different from restless legs syndrome. Restless legs usually cause an urge to move the legs and strange feelings such as tingling or crawling.

Why Magnesium Matters to Muscles?

Magnesium is an essential mineral.

Your body uses it to support:

  • Muscle function
  • Nerve function
  • Normal heart rhythm
  • Blood sugar control
  • Blood pressure control
  • Protein production
  • Bone health
  • DNA production

Magnesium takes part in signals that help muscles contract and relax.

This role is real. It does not mean that every cramp proves you have a magnesium shortage.

Does Low Magnesium Cause Leg Cramps?

Severe magnesium deficiency can cause muscle contractions and cramps.

It may also cause:

  • Weakness
  • Tiredness
  • Loss of appetite
  • Nausea
  • Vomiting
  • Numbness
  • Tingling
  • Abnormal heart rhythm
  • Seizures in severe cases

True symptoms caused only by a low food intake are uncommon in healthy people. The kidneys help keep magnesium in the body when intake becomes low.

A shortage is more likely when a health condition or medicine affects absorption or increases magnesium loss.

Who Has a Higher Risk of Low Magnesium?

Risk may be higher in:

  • People with Crohn's disease
  • People with celiac disease
  • People with long lasting diarrhea
  • People who had part of the small intestine removed
  • People with type 2 diabetes
  • People with long term alcohol dependence
  • Older adults
  • People who eat a very limited diet
  • People who take certain medicines

Some diuretics can increase magnesium loss.

Long-term use of some acid-reducing medicines may also lower magnesium levels.

Do not stop a prescribed medicine. Ask your doctor or pharmacist whether it could affect your mineral levels.

Do Magnesium Supplements Stop Leg Cramps?

Magnesium supplements are often promoted as a fast answer for cramps.

The evidence is less certain.

A Cochrane review found that magnesium was unlikely to reduce the frequency or severity of common muscle cramps in older adults.

Research involving pregnant women had problems and gave mixed results. This means experts remain unsure whether magnesium helps pregnancy-related leg cramps.

There was not enough evidence for cramps linked with exercise or many medical conditions.

A supplement may still be needed when a healthcare professional finds a magnesium shortage.

That is different from taking magnesium for every unexplained cramp.

How Much Magnesium Do Adults Need?

Daily needs depend on age, sex, pregnancy, and breastfeeding.

GroupRecommended Daily Amount
Adult men aged 19 to 30400 milligrams
Adult men aged 31 and older420 milligrams
Adult women aged 19 to 30310 milligrams
Adult women aged 31 and older320 milligrams
Pregnant adultsUsually 350 to 360 milligrams
Breastfeeding adultsUsually 310 to 320 milligrams

These amounts include magnesium from food, drinks, supplements, and medicine.

Your personal needs may be different when you have kidney disease, digestive disease, diabetes, pregnancy, or a diagnosed deficiency.

Top Foods High in Magnesium for Leg Cramps

The amounts below are based on typical servings. The exact amount can change with the brand, variety, and cooking method.

FoodServingApproximate Magnesium
Pumpkin seeds1 ounce156 milligrams
Chia seeds1 ounce111 milligrams
Almonds1 ounce80 milligrams
Cooked spinachOne-half cup78 milligrams
Cashews1 ounce74 milligrams
PeanutsOne quarter cup63 milligrams
Shredded wheat cereal2 large biscuits61 milligrams
Plain soy milk1 cup61 milligrams
Cooked black beansOne-half cup60 milligrams
Cooked edamameOne-half cup50 milligrams
Peanut butter2 tablespoons49 milligrams
Baked potato with skinAbout 3.5 ounces43 milligrams
Cooked brown riceOne-half cup42 milligrams
Plain low-fat yogurt8 ounces42 milligrams
Instant oatmeal1 packet36 milligrams
Canned kidney beansOne-half cup35 milligrams
Banana1 medium32 milligrams
Milk1 cup27 milligrams
Cooked salmon3 ounces26 milligrams
Whole wheat bread1 slice23 milligrams
AvocadoOne-half cup22 milligrams

1. Pumpkin Seeds

Pumpkin seeds are one of the richest common magnesium foods.

One ounce provides about 156 milligrams.

Add a spoonful to oats, yogurt, soup, or salad. You can also eat a small handful as a snack.

Choose unsalted seeds when you need to limit sodium.

2. Chia Seeds

Chia seeds provide magnesium, fibre, and plant fat.

One ounce provides about 111 milligrams of magnesium.

Start with a small amount when your diet is low in fibre. Add one or two teaspoons to yogurt or oats.

Drink enough fluid because chia absorbs water.

3. Almonds

Almonds are an easy snack and a useful source of magnesium.

One ounce provides about 80 milligrams.

A small handful is enough. Nuts are nutritious, but they also contain many calories in a small serving.

Avoid almonds if you have a nut allergy.

4. Cooked Spinach

Cooked spinach provides magnesium, folate, vitamin K, and other nutrients.

One-half cup provides about 78 milligrams of magnesium.

Add spinach to eggs, beans, rice, pasta, or soup.

People taking warfarin should keep vitamin K intake steady and follow medical advice.

5. Cashews

One ounce of cashews provides about 74 milligrams of magnesium.

Use them as a snack or add a small amount to oats and cooked meals.

Choose plain cashews more often than heavily salted or sugar-coated options.

6. Black Beans

One-half cup of cooked black beans provides about 60 milligrams.

Beans also provide fibre and plant protein.

Add them to rice, soup, wraps, or salads.

Start with a small serving if beans cause gas.

7. Edamame

Edamame is a young soybean.

One-half cup provides about 50 milligrams of magnesium.

It also provides plant protein.

Add it to rice bowls, soup, noodles, or salads.

8. Peanut Butter

Two tablespoons provide about 49 milligrams of magnesium.

Spread it on whole wheat toast or eat it with a banana or an apple.

Check the label when you want less added sugar or salt.

9. Potatoes With the Skin

A small baked potato with the skin provides about 43 milligrams.

Potatoes also provide potassium.

Top a baked potato with beans, plain yogurt, or vegetables for a simple meal.

People with kidney disease may need to limit potassium. Follow your medical diet.

10. Brown Rice

One-half cup of cooked brown rice provides about 42 milligrams.

Brown rice can be paired with beans, fish, eggs, chicken, tofu, or vegetables.

White rice contains less magnesium because refining removes parts of the grain.

11. Plain Yogurt

Eight ounces of plain low-fat yogurt provides about 42 milligrams.

Yogurt also provides protein and calcium.

Add berries, oats, chia seeds, or pumpkin seeds.

Choose a suitable alternative if you have a milk allergy or cannot tolerate lactose.

12. Oatmeal

One packet of plain instant oatmeal provides about 36 milligrams.

Amounts vary by product.

Oats become a stronger magnesium meal when you add almonds, chia seeds, pumpkin seeds, peanut butter, or soy milk.

13. Bananas

One medium banana provides about 32 milligrams of magnesium.

Bananas are useful foods, but they are not a high magnesium cure for cramps by themselves.

They also contain potassium and carbohydrates, which can make them a practical snack before activity.

14. Whole Wheat Bread

One slice provides about 23 milligrams of magnesium.

Use it with peanut butter, eggs, beans, tuna, or yogurt to build a balanced meal.

Choose gluten-free foods when you have celiac disease or another medical reason to avoid gluten.

15. Avocado

One-half cup provides about 22 milligrams of magnesium.

Avocado also provides fibre and unsaturated fat.

Add it to eggs, toast, beans, rice bowls, or salad.

16. Salmon

Three ounces of cooked salmon provides about 26 milligrams of magnesium.

Salmon is not one of the richest magnesium foods. It still provides protein, vitamin B12, and omega-3 fats.

A full meal with salmon, brown rice, and spinach provides more magnesium than salmon alone.

A Simple Magnesium-Rich Breakfast

Try this easy meal:

  • One bowl of oatmeal
  • One tablespoon of chia seeds
  • One tablespoon of pumpkin seeds
  • One sliced banana
  • Plain yogurt or soy milk

This meal provides magnesium from several foods instead of relying on one large supplement.

A Simple Magnesium-Rich Lunch

Build a bowl with:

  • Brown rice
  • Black beans
  • Cooked spinach
  • Avocado
  • Tomato
  • A suitable protein

Keep portions comfortable. Increase beans and high-fibre foods slowly when you are not used to them.

A Simple Magnesium-Rich Dinner

Try:

  • Baked salmon or tofu
  • A potato with the skin
  • Cooked spinach or another vegetable
  • Plain yogurt when tolerated

This meal also provides protein and other nutrients needed for normal muscle health.

A One-Day Foods High in Magnesium for Leg Cramps Plan

This plan is only an example. Change it for allergies, kidney disease, diabetes, pregnancy, culture, and personal needs.

Breakfast

Oats made with soy milk, banana, and chia seeds.

Morning Snack

A small handful of almonds.

Lunch

Brown rice with black beans, spinach, tomato, and avocado.

Afternoon Snack

Plain yogurt with pumpkin seeds.

Dinner

Salmon or tofu with a baked potato and cooked vegetables.

Other Nutrients Linked With Muscle Function

Magnesium is not the only mineral involved in muscle function.

Your body also uses:

  • Potassium
  • Calcium
  • Sodium
  • Phosphorus
  • Water
  • Carbohydrate
  • Protein

Low blood levels of magnesium, potassium, or calcium may cause cramps.

This does not mean you should take several mineral supplements at once.

Too much potassium, calcium, sodium, or magnesium can be dangerous. This is especially important for people with kidney or heart disease.

For calcium food ideas, read the NextFitLife calcium-rich foods guide.

Does Dehydration Cause Leg Cramps?

Dehydration may contribute to cramps in some situations.

Risk may rise during long exercise, heavy sweating, vomiting, diarrhea, or hot weather.

Drink regularly and use thirst as one guide.

You may need more fluid during exercise or hot weather.

People with heart, kidney, or liver disease may have a fluid limit. Follow advice from your healthcare team.

More water will not fix every cramp. Drinking extreme amounts can also be unsafe.

Common Causes of Leg Cramps

Possible causes include:

  • Muscle strain
  • Muscle overuse
  • Long exercise
  • Hot or humid weather
  • Dehydration
  • Pregnancy
  • Aging
  • Long periods of sitting
  • Some medicines
  • Poor blood flow
  • Nerve pressure
  • Dialysis
  • Low electrolyte levels
  • Liver disease
  • An unknown cause

Cramps can happen even when a person gets enough magnesium.

Medicines That May Be Linked With Cramps

Some people report cramps while taking certain medicines.

Examples may include:

  • Diuretics
  • Cholesterol medicines
  • Asthma medicines
  • Hormone treatments
  • Osteoporosis medicines
  • Acid-reducing medicines

A medicine may also change magnesium or other electrolyte levels.

Do not stop medicine on your own.

Ask a doctor or pharmacist to review your medicines when cramps begin after a new treatment or dose change.

What to Do During a Leg Cramp

Try these simple steps:

  1. Stop the activity.
  2. Gently stretch the tight muscle.
  3. Massage the area.
  4. Stand and place weight on the leg when it is safe.
  5. Use gentle warmth while the muscle is tight.
  6. Drink fluid when dehydration may be present.

Do not force a painful stretch.

Stop if the movement causes sharp pain or feels unsafe.

Calf Stretch for Night Leg Cramps

Stand facing a wall.

Place both hands on the wall.

Move the affected leg behind you.

Keep the heel on the floor.

Bend the front knee and lean forward slowly.

Stop when you feel a gentle stretch in the calf.

Do not bounce.

Use a chair or ask for help if your balance is poor.

Regular calf stretching may reduce cramps for some people, but it may not stop them completely.

Exercise Cramps and Magnesium Foods

Exercise cramps often follow hard work, muscle fatigue, heat, or heavy sweating.

The answer is not always a magnesium tablet.

A safer plan may include:

  • Build exercise slowly
  • Warm up
  • Use suitable shoes
  • Drink enough fluid
  • Eat regular balanced meals
  • Rest tired muscles
  • Review training volume
  • Replace heavy sweat losses when needed

A sports dietitian or healthcare professional can help when cramps keep returning during exercise.

Night Leg Cramps and Magnesium Foods

Night cramps are common in older adults and during pregnancy.

They may happen without a clear cause.

Try:

  • Gentle calf stretching before bed
  • Comfortable movement during the day
  • Enough fluid
  • Regular balanced meals
  • A review of your medicines
  • Supportive footwear

Magnesium foods can support normal nutrition. They are not guaranteed to stop night cramps.

Leg Cramps During Pregnancy

Leg cramps are common later in pregnancy.

Do not begin a magnesium supplement without speaking with your maternity care team.

Research has not given a clear answer about magnesium supplements for pregnancy related cramps.

Your clinician can review:

  • Your diet
  • Your prenatal vitamin
  • Your magnesium intake
  • Your calcium intake
  • Your iron level
  • Your fluid intake
  • Your medicines
  • Other possible causes

Sudden pain and swelling in one leg during pregnancy needs urgent medical assessment.

Should You Get a Magnesium Blood Test?

A healthcare professional may order a magnesium test when symptoms or medical history suggest an abnormal level.

A test may be considered when you have cramps with:

  • Weakness
  • Numbness
  • Tingling
  • An abnormal heart rhythm
  • Long lasting diarrhea
  • Frequent vomiting
  • Kidney disease
  • Diabetes
  • Medicine that affects electrolytes

A normal blood result does not answer every muscle cramp question. Your clinician may also check calcium, potassium, kidney function, thyroid health, iron, or other tests.

Magnesium Supplement Safety

Food magnesium does not need a set upper limit for healthy people. Healthy kidneys usually remove extra magnesium from food.

Supplements and medicines are different.

For adults, the upper limit for magnesium from supplements and medicines is 350 milligrams per day unless a healthcare professional recommends more.

This limit does not include magnesium that occurs naturally in food.

Too much supplemental magnesium may cause:

  • Diarrhea
  • Nausea
  • Stomach cramps
  • Low blood pressure
  • Weakness
  • Breathing problems
  • An abnormal heart rhythm
  • Cardiac arrest in extreme cases

Kidney Disease Warning

People with kidney disease may not remove extra magnesium normally.

This raises the risk of dangerous magnesium buildup.

Do not use a magnesium supplement, laxative, or antacid without medical advice when you have kidney disease.

Medicine Interactions

Magnesium supplements can affect some medicines.

These include some:

  • Antibiotics
  • Osteoporosis medicines
  • Diuretics
  • Acid reducing medicines

A pharmacist can tell you whether the products must be taken at different times.

Which Magnesium Supplement Is Best for Leg Cramps?

No magnesium form has been proven to be the best choice for ordinary leg cramps.

Some forms dissolve and absorb better than others. These may include magnesium citrate, chloride, lactate, and aspartate.

Better absorption does not prove better cramp relief.

Magnesium citrate may cause loose stools because it can act as a laxative.

Choose a supplement only after discussing the cause of your cramps and the correct dose with a qualified professional.

Do Not Use Quinine on Your Own

Quinine has been used for leg cramps in some places.

It can cause serious side effects and is not suitable for many people.

Do not buy quinine or use tonic water as a cramp treatment without medical advice.

Speak with a doctor about safer options.

When Leg Cramps Need Medical Care

Contact a healthcare professional when cramps:

  • Happen often
  • Disturb your sleep
  • Are severe
  • Last more than 10 minutes
  • Do not improve with gentle stretching and enough fluid
  • Begin after a new medicine
  • Come with numbness
  • Come with muscle weakness
  • Come with swelling, redness, or warmth
  • Affect only one leg again and again

Seek urgent medical care for:

  • Sudden swelling in one leg
  • A red or warm painful leg
  • Chest pain
  • Shortness of breath
  • Fainting
  • A severe injury
  • Loss of movement
  • New severe weakness

These signs may point to a blood clot or another serious problem.

Common Myths About Foods High in Magnesium for Leg Cramps

Myth: Every leg cramp means low magnesium

No. Many cramps come from muscle strain, aging, pregnancy, dehydration, medicine, nerve problems, or an unknown cause.

Myth: A banana gives enough magnesium to stop cramps

A banana provides some magnesium and potassium. It is not an instant cure.

Myth: More magnesium works better

No. Large supplement doses may cause diarrhea and serious harm.

Myth: Magnesium oil always enters the muscles

Products used on the skin are often promoted for cramps. Good evidence that they correct magnesium status or prevent cramps is limited.

Myth: Sports drinks are needed for every cramp

Most short or gentle activities do not require a sports drink. Long, hot, or very sweaty exercise may need a more personal hydration plan.

Myth: Food can replace a medical check

No. Frequent cramps, weakness, numbness, swelling, or redness need proper assessment.

Five High Authority References and Sources

  1. National Institutes of Health Office of Dietary Supplements: Magnesium Fact Sheet for ConsumersOpen guidance about daily needs, food sources, deficiencies, supplement safety, upper limits, and medicine interactions.
  2. National Institutes of Health Office of Dietary Supplements: Magnesium Fact Sheet for Health ProfessionalsOpen detailed guidance with current dietary targets, food values, deficiency risks, safety limits, and clinical evidence.
  3. Cochrane: Magnesium for Muscle CrampsOpen evidence summary about magnesium supplements for cramps in older adults, pregnancy, and medical conditions.
  4. MedlinePlus: Muscle CrampsOpen United States government guidance about causes, prevention, stretching, hydration, treatment, and warning signs.
  5. National Health Service: Leg CrampsOpen guidance about symptoms, common causes, stretching, self care, and when to contact a doctor.

Conclusion: Foods High in Magnesium for Leg Cramps

Foods High in Magnesium for Leg Cramps can improve your magnesium intake, but they cannot solve every cramp.

Start by adding one useful food, such as pumpkin seeds, beans, spinach, almonds, or oats. Drink enough fluid and stretch gently.

Track when your cramps happen. Then speak with a healthcare professional if they are frequent, severe, or linked with weakness, numbness, redness, or swelling.

Internal Links and NextFitLife Hubs

About the Author

Adel Galal is the founder and lead writer of NextFitLife.

He has more than 30 years of independent study and practical interest in nutrition, fitness, mobility, weight management, sleep, and healthy aging.

He has also spent more than 15 years writing health and wellness content.

His long professional background in information technology management shaped his research process. He compares trusted sources, checks dates, reviews safety guidance, and turns complex health topics into clear daily steps.

Adel is not a dermatologist, doctor, neurologist, pharmacist, registered dietitian, physical therapist, or sports medicine specialist.

This content does not replace professional medical advice. What he shares comes from real-life experience with healthy eating and daily wellness, extensive research, and consultation with healthcare providers.

Always consult qualified medical professionals for diagnosis and treatment of any health condition.

Read the NextFitLife Medical Review Policy and the NextFitLife Editorial Policy.

Frequently Asked Questions About Foods High in Magnesium for Leg Cramps

What are the best Foods High in Magnesium for Leg Cramps?

Useful choices include pumpkin seeds, chia seeds, almonds, spinach, cashews, black beans, edamame, peanut butter, brown rice, yogurt, oats, and potatoes with the skin.

Will magnesium foods stop leg cramps?

They may help when your diet is low in magnesium. They will not stop every cramp because muscle strain, dehydration, pregnancy, aging, medicine, nerve problems, and other issues may cause cramps.

Does every leg cramp mean magnesium deficiency?

No. Severe magnesium deficiency can cause cramps, but symptomatic deficiency is uncommon in otherwise healthy people. Most common cramps have another cause or no clear cause.

How much magnesium do adults need each day?

Adult men usually need 400 to 420 milligrams. Adult women usually need 310 to 320 milligrams. Pregnancy and other health needs may change the target.

Which food has the most magnesium?

Among common foods, pumpkin seeds are a rich source. One ounce provides about 156 milligrams. Chia seeds, almonds, spinach, and cashews are also useful choices.

Are bananas high in magnesium?

A medium banana provides about 32 milligrams. It contributes to daily intake but contains much less magnesium than pumpkin seeds, chia seeds, almonds, or cooked spinach.

Should I take magnesium before bed for night leg cramps?

Do not assume it will help. Research suggests that magnesium supplements are unlikely to prevent common cramps in many older adults. Ask a healthcare professional before using a supplement.

Is magnesium safe during pregnancy?

Magnesium is an essential nutrient, but pregnancy supplement needs should be discussed with a maternity care professional. Evidence for using supplements to treat pregnancy-related leg cramps is uncertain.

Can too much magnesium be dangerous?

Yes. High amounts from supplements or medicines can cause diarrhea, nausea, low blood pressure, an abnormal heart rhythm, and serious toxicity. Risk is higher with kidney disease.

When should I see a doctor for leg cramps?

Seek medical advice when cramps are frequent, severe, last longer than 10 minutes, disturb sleep, or come with weakness, numbness, swelling, redness, or warmth.

Scroll to Top