What Foods Have Magnesium for Leg Cramps?

Several common foods pack enough magnesium to help you meet the 310–420 mg daily recommendation that keeps muscles functioning properly. Pumpkin seeds top the list at 150 mg per ounce, but dark leafy greens, beans, and even dark chocolate contribute meaningful amounts. Whether these foods will actually stop your leg cramps depends on what’s causing them, and the answer is more nuanced than most articles let on.

How Magnesium Affects Your Muscles

Magnesium plays a direct role in muscle relaxation. When a muscle contracts, calcium floods into the muscle fibers and triggers them to tighten. Magnesium competes with calcium for the same binding sites on muscle proteins, essentially blocking calcium from keeping the muscle in a contracted state. When magnesium levels drop too low, calcium can overstimulate the muscle, leading to involuntary contractions and cramping.

This is also why magnesium doesn’t work alone. Potassium and calcium are both involved in the electrical signals that tell muscles when to contract and relax. A shortage of any of these three minerals can contribute to leg cramps, and some blood pressure medications make the problem worse by increasing urination, which drains all three from the body.

Best Food Sources of Magnesium

Seeds

Seeds are the most magnesium-dense foods you can eat. One ounce of roasted pumpkin seeds (about a small handful) delivers 150 mg of magnesium, covering roughly 36–48% of the daily recommendation depending on your sex and age. Chia seeds come in at 111 mg per ounce. Either one stirred into yogurt, oatmeal, or a smoothie gets you nearly halfway to your daily target before lunch.

Leafy Greens

Cooked greens concentrate magnesium because you’re eating far more leaves per cup than you would raw. One cup of cooked Swiss chard provides 151 mg of magnesium. Cooked spinach is in the same range. The key word is “cooked.” A cup of raw spinach has only a fraction of that amount because raw leaves are mostly air and water by volume. Sautéing, steaming, or adding greens to soups dramatically increases what you actually consume per serving.

Beans and Legumes

A cup of cooked edamame delivers 108 mg of magnesium, while a cup of cooked black beans provides 91 mg. These are practical, inexpensive staples that also supply potassium and fiber. Adding beans to a meal that already includes greens or seeds can push a single plate past 200 mg of magnesium without any supplements.

Other Notable Sources

Almonds and cashews typically contain 70–80 mg per ounce. Brown rice, whole wheat bread, and fortified cereals each contribute 30–60 mg per serving. Avocados, bananas, and fatty fish like salmon round out the list at moderate but useful levels. Dark chocolate (70% cacao or higher) also provides a meaningful dose per serving, making it one of the more enjoyable ways to add magnesium to your diet.

How Much You Actually Absorb

Your body absorbs only about 30–40% of the magnesium you eat. That means if you consume 400 mg from food in a day, you’re actually getting 120–160 mg into your system. This is normal, and the daily recommendations already account for it. You don’t need to multiply your intake to compensate.

One advantage of food-based magnesium over supplements is safety. Your kidneys efficiently filter out excess magnesium from food, making toxicity from dietary sources essentially impossible. Supplements are a different story. The tolerable upper limit for supplemental magnesium is 350 mg per day, above which digestive side effects like diarrhea become common. There’s no equivalent ceiling for magnesium from meals.

Will Magnesium Actually Fix Your Leg Cramps?

This is where it gets complicated. If your cramps are caused by a genuine magnesium deficiency, eating more magnesium-rich foods should help. But most nocturnal leg cramps, the kind that wake you up at night with a calf muscle locked in a spasm, may not respond to magnesium at all.

A randomized clinical trial published in JAMA Internal Medicine tested magnesium supplements against a placebo in 94 adults with nocturnal leg cramps. Both groups experienced fewer cramps over time, but the magnesium group did no better than the placebo group. The researchers concluded that the improvement people commonly attribute to magnesium is likely a placebo effect, which may explain why so many people swear by it despite the lack of clinical support.

That said, the study used a supplement form (magnesium oxide) with relatively poor absorption. And correcting an actual deficiency is different from adding extra magnesium on top of adequate levels. If your diet has been low in magnesium for a while, increasing your intake through food is a reasonable first step. You’ll also pick up potassium, calcium, and other electrolytes along the way, which may matter just as much.

A Practical Daily Eating Plan

Meeting 400 mg of magnesium per day from food is straightforward if you build it across meals rather than relying on a single source. A realistic day might look like this: a handful of pumpkin seeds with breakfast (150 mg), a cup of cooked spinach or Swiss chard at lunch (about 150 mg), and a cup of black beans at dinner (91 mg). That puts you at roughly 390 mg without trying especially hard.

If you’re not used to eating this way, even small additions help. Swapping white rice for brown rice, choosing whole grain bread, snacking on almonds, or adding a tablespoon of chia seeds to a drink each add 30–80 mg. These changes compound quickly. Most people who get enough magnesium aren’t doing anything dramatic. They just eat whole, unprocessed foods more often than not.