Most people don’t realize they’re running low on one of the body’s most essential minerals until their legs start twitching at midnight. Magnesium quietly powers hundreds of processes in the body, and when levels slip, the symptoms show up first in the places you least want them: your muscles and your sleep.
Magnesium is needed for more than 300 biochemical reactions in the body. It helps to maintain normal nerve and muscle function, supports a healthy immune system, keeps the heartbeat steady, and helps bones remain strong. Yet the shortfall is surprisingly common. Globally, an estimated 2.4 billion people, or roughly 31% of the global population, fail to meet the recommended magnesium intake levels. In the United States, the picture is even more striking. Data from the National Health and Nutrition Examination Survey indicates that nearly half of all adults in the US consume less magnesium than the estimated average requirement.
The good news is you don’t need a supplement prescription to start fixing this. The seven foods below are among the most concentrated dietary sources of magnesium available, and they’re things most people can find at any grocery store.
Why Magnesium and Your Muscles Are Inseparable

Before diving into the foods themselves, it helps to understand what’s actually happening inside your body. Biologically, calcium causes muscles to contract, while magnesium helps them relax. When you don’t have enough magnesium on board, that relaxation step gets disrupted.
Magnesium deficiency can cause problems with nerve impulse conduction, muscle contractions, and muscle cramps, which can potentially contribute to restless leg syndrome. This mechanism is straightforward: without adequate magnesium, muscles can get stuck in a partial contracted state instead of releasing fully.
Magnesium plays a pivotal role in various physiological processes, including energy metabolism, muscle contraction, protein synthesis, and DNA synthesis. It acts as a cofactor for more than 300 enzymatic reactions, facilitating the conversion of adenosine triphosphate to adenosine diphosphate for energy production. No other single mineral touches quite as many systems at once.
The Sleep Connection: What Research Says

Restless leg syndrome is a disorder of the nervous system that causes the overwhelming urge to move your legs. It’s often accompanied by pain, throbbing, or other unpleasant sensations. Symptoms often increase when you’re inactive, like when you’re sitting or lying down, which can make RLS disruptive to sleep.
A notable recent open-label pilot study published in the Journal of Clinical Sleep Medicine in 2024 provided promising results for magnesium supplementation. The study administered 200 mg of magnesium citrate daily for 8 weeks to 12 adults with primary RLS. Participants showed significant reduction in International Restless Legs Syndrome Study Group Rating Scale scores and improved quality of life measurements.
A 2024 systematic review found that magnesium oxide significantly improved sleep quality and RLS symptoms, with magnesium showing greater effectiveness than vitamin B6. That said, the science remains nuanced. Recent clinical trials support magnesium’s potential as a therapeutic option with minimal side effects, though larger placebo-controlled studies are still needed to establish definitive guidelines.
Food #1: Pumpkin Seeds

Pumpkin seeds are a particularly good source of magnesium, with 168 mg in a 1-oz (28-g) serving. This amounts to roughly 40% of the daily value for magnesium. That’s a remarkable return for something you can sprinkle on a salad.
In addition, seeds are rich in iron, monounsaturated fat, and omega-3 fatty acids. The combination of magnesium, healthy fats, and antioxidants makes pumpkin seeds genuinely one of the most nutritionally dense snack options available. Pumpkin seeds are also an excellent source of nutrients including calcium, potassium, zinc, and selenium.
Food #2: Cooked Spinach

Leafy greens with significant amounts of magnesium include spinach, kale, collard greens, and mustard greens, but spinach tops the list with 158 mg of magnesium in a single one-cup cooked serving. Cooking matters here: heat collapses the leaf volume significantly, making it easier to eat more in one sitting.
Leafy greens like spinach are also an excellent source of iron, manganese, and vitamins A, C, and K, and contain many beneficial plant compounds that help protect your cells from damage and may reduce cancer risk. It’s one of those ingredients where the nutritional value stacks up fast.
Most dietary magnesium comes from dark green, leafy vegetables. If there’s one habit worth building, adding a cup of cooked spinach to your evening meal would be a sensible start.
Food #3: Black Beans

Black beans are not only rich in protein but also a fantastic source of magnesium. One cup of cooked black beans contains roughly 120 mg of magnesium, making them a great addition to soups, stews, and salads.
According to the USDA, one cup of cooked black beans provides over 15 grams of protein, 15 grams of fiber, and key nutrients like magnesium, folate, and potassium, all vital for optimal body function. The fiber content also means they digest slowly, which helps maintain steady energy rather than creating blood sugar spikes.
Because legumes are rich in fiber and have a low glycemic index, they may help lower cholesterol levels. Black beans are inexpensive, shelf-stable, and versatile enough to fit into almost any meal. They’re one of the most underused nutritional tools in most households.
Food #4: Almonds

Almonds are not only a great source of healthy fats but also provide about 80 mg of magnesium per ounce. They’re perfect for snacking, adding to oatmeal, or blending into almond butter.
Dried beans and legumes and nuts such as almonds and cashews are good sources of magnesium, and almonds consistently rank among the most accessible options. A small handful in the afternoon covers a meaningful portion of the day’s magnesium target without needing any preparation.
Almonds also carry vitamin E, fiber, and a good dose of healthy monounsaturated fat. The combination supports not just muscle recovery but also cardiovascular health, making them genuinely worth the daily habit.
Food #5: Avocados

One whole avocado contains 58 mg of magnesium. It’s not the highest per-serving number on this list, but avocados carry something many other magnesium sources don’t: healthy monounsaturated fats that support the absorption of fat-soluble nutrients.
Research has shown that eating avocados can reduce inflammation, improve cholesterol levels, and increase feelings of fullness after meals. That satiety benefit is practically useful for anyone trying to build more nutrient-dense meals without overeating.
A medium avocado contains about 58 mg of magnesium, along with healthy monounsaturated fats and fiber. Paired with spinach or black beans in a bowl or salad, an avocado can help push a single meal well past 200 mg of magnesium combined.
Food #6: Dark Chocolate

Dark chocolate is very rich in magnesium, with 65 mg in a 1-ounce serving, which is about 28 grams. It’s also high in iron, copper, and manganese and contains prebiotic fiber that can help feed the beneficial bacteria in the gut.
The magnesium in dark chocolate may aid in relaxing the muscles, improving blood flow, and managing blood pressure. Dark chocolate is also known to contain prebiotic fiber, which may help restructure the gut microbiome’s diversity. It also contains flavonols, potent antioxidants that may manage LDL cholesterol from oxidizing and adhering to the cells lining your arteries.
Choose a dark chocolate with at least 70% cocoa solids to get the most benefit with the least added sugar. This is one food that earns its reputation as more than just an indulgence.
Food #7: Quinoa

A half-cup of cooked quinoa provides 60 mg of magnesium. Scale that to a full cup and it becomes a genuinely meaningful contribution to the day’s total. Quinoa is also known for its many health benefits, including a high protein and mineral content.
Unlike most grains, quinoa is a complete protein, meaning it contains all nine essential amino acids. This makes it particularly useful for people who rely on plant-based diets to meet their nutritional needs, combining protein and magnesium in a single base ingredient.
Some types of food processing, such as refining grains in ways that remove the nutrient-rich germ and bran, substantially lower the magnesium content. Whole grains like quinoa sidestep that problem entirely, which is exactly why nutritionists consistently point to them over processed alternatives.
How Much Do You Actually Need Each Day?

If you’re a woman aged 19 or older, you need 310 milligrams a day, or 350 milligrams if you’re pregnant. If you’re an adult man under age 30, you need 400 milligrams a day. After 30, men need 420 milligrams.
Approximately 30% to 40% of the dietary magnesium consumed is typically absorbed by the body. That absorption rate is worth keeping in mind. Eating a variety of the foods above daily is more effective than relying on one single source, since different forms of magnesium from different food matrices absorb at slightly different rates.
Although epidemiological studies show that higher magnesium diets are associated with lower rates of disease, results are mixed from clinical trials showing that magnesium supplementation can correct these conditions. It may be because a magnesium-rich diet is often higher in other nutrients, which collectively work together in disease prevention as opposed to a supplement containing a single nutrient. The message from the science is fairly clear: food first.
Why Modern Diets Keep Coming Up Short

One of the primary causes of magnesium deficiency is the standard American diet, which often lacks magnesium-rich foods. Processed and refined foods, which make up a significant portion of many Americans’ diets, are typically low in magnesium. Agricultural practices have also played a role in the declining magnesium content of foods.
Chronic stress, which is prevalent in American society, can increase magnesium excretion through urine. Additionally, certain medications, such as proton pump inhibitors and diuretics, can interfere with magnesium absorption or increase its loss from the body. The consumption of caffeine and alcohol can also impact magnesium levels.
A 2024 Australian study identified why a diet rich in magnesium is so important for health, reducing the risk of DNA damage and chronic degenerative disorders. Scientists from the University of South Australia measured blood samples from 172 middle-aged adults, finding a strong link between low magnesium levels and high amounts of a genotoxic amino acid called homocysteine. This toxic combination damages the body’s genes, making people more susceptible to Alzheimer’s and Parkinson’s disease, gastrointestinal diseases, a range of cancers, and diabetes.
Putting It Together: A Practical Approach

To get the recommended amount of magnesium the body requires, one approach is to eat five servings of fruits and vegetables per day, at least three servings of whole grains per day, one ounce or a quarter cup of nuts or seeds per day, and one serving of legumes most days of the week.
Extra magnesium from food is safe because the kidneys will eliminate excess amounts in urine. That means there’s very little risk in simply eating more of these foods regularly, unlike high-dose supplementation which can cause digestive discomfort.
The recommended approach includes testing for magnesium deficiency, considering dietary modifications to increase natural magnesium intake, and potentially adding supplements at appropriate dosages if needed. If leg cramps or poor sleep are persistent, it’s worth talking to a doctor before assuming diet alone is the answer, since other deficiencies or underlying conditions may be involved.
The connection between what you eat and how you sleep is rarely as direct as it is with magnesium. Seven foods, consistently on the plate, won’t solve every restless night. But for a problem that’s largely driven by a quiet, correctable shortfall, the kitchen is a reasonable place to start.


