
Magnesium rich foods can help you meet your daily magnesium needs while providing other important nutrients. Seeds, nuts, legumes, whole grains and leafy greens are among the best natural sources.
Magnesium is essential for normal nerve and muscle function, but whether increasing magnesium intake directly improves sleep is still being studied.
When you’re struggling with sleep, it is tempting to look for one food or nutrient that might make a difference. Magnesium often appears on that list.
Table of Contents
Magnesium Rich Foods for Sleep
There is a good reason for the interest. Your body needs magnesium for hundreds of biological processes, including normal nerve and muscle function, energy metabolism, protein production and the maintenance of healthy bones.
But there is an important distinction between getting enough magnesium and taking extra magnesium to improve sleep.
The first is an established nutritional requirement. The second is still an open research question.
Some studies have found an association between magnesium status and sleep, but clinical trials have not produced consistent results. A systematic review involving 7,582 adults across nine studies found that observational research generally suggested a relationship between magnesium status and sleep quality, while randomized clinical trials produced contradictory findings.
That doesn’t make magnesium irrelevant to sleep. It simply means we should be careful about what the evidence actually tells us.
Instead of thinking of these foods as natural sleeping pills, think of them as part of a varied, nutrient-rich diet that helps your body get the magnesium it needs.
And there are plenty of delicious ways to do that.
How Much Magnesium Do You Need Each Day?
Your magnesium requirement depends mainly on age and sex.
For most adults, the recommended daily amount is between 310 and 420 mg. Requirements are somewhat higher during pregnancy.
| Life stage | Recommended magnesium per day |
|---|---|
| Men 19–30 | 400 mg |
| Men 31+ | 420 mg |
| Women 19–30 | 310 mg |
| Women 31+ | 320 mg |
| Pregnant women | 350–360 mg |
| Breastfeeding women | 310–320 mg |
These numbers represent your overall recommended intake, not a special amount you should take at bedtime.
The National Institutes of Health identifies legumes, nuts, seeds, whole grains and green leafy vegetables among the main natural food sources of magnesium. Fortified foods and some dairy products can contribute too.
Take-Home Message
Don’t chase a special “sleep dose” of magnesium. The practical goal is to regularly meet your nutritional needs through a varied diet.
15 Magnesium-Rich Foods at a Glance
Before getting into each food, here’s the quick overview.
The exact magnesium content of foods can vary according to variety, growing conditions, preparation, processing and serving size. USDA FoodData Central is a comprehensive source of food-composition data, and its food records can be updated over time.
For that reason, the table below uses approximate values and standard serving descriptions rather than suggesting that every brand or preparation will contain exactly the same amount.
| Food | Typical serving | Approx. magnesium | Why it’s useful |
|---|---|---|---|
| Pumpkin seeds | 1 oz | ~150–170 mg | Very concentrated source |
| Chia seeds | 1 oz | ~90–100 mg | Magnesium + fiber |
| Almonds | 1 oz | ~75–80 mg | Easy everyday snack |
| Cashews | 1 oz | ~70–75 mg | Versatile nut |
| Spinach, cooked | ½–1 cup | ~75–80 mg | Leafy-green source |
| Black beans, cooked | ½ cup | ~60 mg | Magnesium + protein + fiber |
| Edamame | ½ cup | ~50–60 mg | Magnesium + plant protein |
| Quinoa, cooked | 1 cup | ~115–120 mg | Magnesium + protein |
| Oatmeal, cooked | 1 cup | ~55–60 mg | Easy breakfast base |
| Avocado | 1 medium | ~55–60 mg | Magnesium + fiber + healthy fats |
| Tofu | ½ cup | Varies by product | Plant protein |
| Whole-wheat bread | 2 slices | Varies | Easy everyday swap |
| Brown rice, cooked | 1 cup | ~80–85 mg | Everyday whole grain |
| Dark chocolate | 1 oz | ~60–65 mg | Magnesium-containing treat |
| Peanuts | 1 oz | ~45–50 mg | Affordable snack |
Note: Values are approximate and can vary by product, preparation and serving size. For publication, I recommend linking the table’s source note to USDA FoodData Central rather than presenting the numbers as universal values. USDA describes FoodData Central as its comprehensive food-composition database.
The table also reveals something useful: you don’t have to rely on one food.
A diet containing several of these foods can make it much easier to obtain magnesium throughout the day.
1. Pumpkin Seeds
Pumpkin seeds are one of the most concentrated and convenient food sources of magnesium.
A relatively small serving can make a meaningful contribution toward your daily requirement. They also provide protein, unsaturated fats and other minerals, so you’re getting considerably more than magnesium alone.
They’re remarkably easy to use.
Add them to:
- Oatmeal
- Yogurt
- Salads
- Grain bowls
- Soups
- Homemade granola
You can also eat a small portion as a snack.
Easy way to use them
Sprinkle pumpkin seeds over oatmeal with chia seeds and fruit.
Why they stand out: A small serving provides a substantial amount of magnesium and requires almost no preparation.
2. Chia Seeds
Chia seeds are tiny, but nutritionally dense.
They provide magnesium alongside fiber, plant-based protein and healthy fats. Their mild flavor also makes them easy to add to foods you already eat.
Try them in:
- Overnight oats
- Chia pudding
- Smoothies
- Yogurt
- Oatmeal
- Homemade snack bars
Easy way to use them
Mix chia seeds into plain yogurt and add berries and chopped almonds.
Why they stand out: They combine magnesium with fiber and other nutrients in a small serving.
3. Almonds
Almonds are one of the easiest magnesium-rich foods to make part of your normal routine.
A small handful can work as a snack, while sliced almonds can be added to breakfast bowls, salads and cooked vegetables.
They also provide protein, fiber and unsaturated fats.
Easy way to use them
Add chopped almonds to oatmeal, or pair a small handful with fruit.
Why they stand out: They’re portable, versatile and require no preparation.
4. Cashews
Cashews provide magnesium along with protein and unsaturated fats.
Their relatively mild flavor makes them particularly versatile. You can use them in both sweet and savory meals.
Try them in:
- Stir-fries
- Grain bowls
- Salads
- Oatmeal
- Trail mix
- Nut mixes
Easy way to use them
Add a small portion of cashews to a fruit-and-yogurt snack.
Why they stand out: They’re an easy way to add magnesium without dramatically changing a meal.
5. Spinach
Spinach is one of the most useful leafy greens for a magnesium-rich eating pattern.
Leafy green vegetables are specifically recognized by the NIH as natural magnesium sources.
You can eat spinach raw in salads, but cooking also makes it easier to consume a larger amount.
Use it in:
- Omelets
- Dal
- Curries
- Soups
- Pasta
- Stir-fries
Easy way to use it
Add cooked spinach to dal or make a spinach omelet for breakfast.
Why it stands out: It contributes magnesium while bringing a range of other vitamins, minerals and plant compounds.
6. Black Beans
Beans are one of the most useful food groups to include in a magnesium-rich diet.
Black beans provide magnesium together with plant protein and fiber, making them a substantial part of a meal rather than simply a nutrient source.
Use them in:
- Salads
- Soups
- Wraps
- Grain bowls
- Chilli
- Bean-based curries
Easy way to use them
Combine black beans with quinoa, spinach and avocado.
Why they stand out: You get magnesium along with protein and fiber.
7. Edamame
Edamame, or young soybeans, is another useful plant-based magnesium source.
It also provides protein and fiber, making it more filling than many conventional snacks.
Try it in:
- Rice bowls
- Salads
- Stir-fries
- Noodle dishes
- Vegetable bowls
Easy way to use it
Steam edamame and season it lightly for a simple side dish.
Why it stands out: It combines magnesium with plant protein in a convenient food.
8. Quinoa
Quinoa is technically a seed, although it is commonly prepared and eaten like a grain.
It can contribute a useful amount of magnesium while also providing protein and fiber.
It works well as a base for:
- Grain bowls
- Salads
- Breakfast bowls
- Stuffed vegetables
- Side dishes
Easy way to use it
Try quinoa with black beans, spinach, avocado and pumpkin seeds.
Now you’re combining several magnesium-containing foods rather than relying on just one.
Why it stands out: It’s a versatile base for a nutrient-dense meal.
9. Oats
Oats are not the most concentrated source of magnesium, but they’re worth including because they’re affordable, familiar and easy to eat regularly.
More importantly, oats pair beautifully with other magnesium-rich foods.
Think:
oats + chia seeds + almonds + pumpkin seeds
rather than oats by themselves.
Easy way to use them
Make oatmeal with milk or fortified plant milk, then add chia seeds, almonds and fruit.
Why they stand out: They’re an everyday food that can carry several other magnesium-rich ingredients.
10. Avocado
Avocado provides magnesium alongside fiber, potassium and mostly unsaturated fat.
It isn’t as concentrated in magnesium as seeds or some nuts, but it can still contribute to your overall intake.
Use it in:
- Whole-grain toast
- Salads
- Grain bowls
- Wraps
- Bean dishes
Easy way to use it
Add avocado to whole-grain toast or a quinoa-and-bean bowl.
Why it stands out: It brings magnesium into meals while also contributing fiber and healthy fats.
11. Tofu
Tofu can provide magnesium while serving as a useful source of plant-based protein.
Its exact nutrient content can vary considerably depending on the product and how it is made, so nutrition labels are worth checking when comparing brands.
Use tofu in:
- Stir-fries
- Curries
- Soups
- Grain bowls
- Salads
Easy way to use it
Pair tofu with brown rice and leafy greens for a simple dinner.
Why it stands out: It brings magnesium and plant protein into the same meal.
12. Whole-Wheat Foods
Whole grains are an important magnesium-containing food group.
You don’t necessarily need to overhaul your diet to eat more of them. Sometimes the simplest approach is to make a familiar food slightly less refined.
Examples include:
- Whole-wheat bread
- Whole-grain pasta
- Bulgur
- Whole-grain cereals
- Other whole-grain foods
The NIH specifically includes whole grains among the main natural sources of magnesium.
Easy way to use them
When choosing bread or pasta, choose a whole-grain version when you enjoy it.
Why they stand out: They can increase magnesium intake through simple everyday food choices.
13. Brown Rice
Brown rice can contribute magnesium while serving as a familiar staple.
It’s particularly useful when combined with other magnesium-containing foods.
Easy way to use it
Try:
Brown rice + black beans + spinach + avocado
That combination is more nutritionally meaningful than looking at brown rice in isolation.
Why it stands out: It’s an easy base for a magnesium-rich meal.
14. Dark Chocolate
Dark chocolate is an interesting addition to the list because it can contain a meaningful amount of magnesium.
But this is where the sleep connection requires some caution.
Cocoa and dark chocolate also contain caffeine and theobromine. For someone sensitive to stimulants, eating chocolate close to bedtime may be counterproductive.
So don’t turn dark chocolate into a “bedtime sleep food.”
Easy way to use it
Enjoy a modest portion during the day or earlier in the evening if you tolerate it well.
Why it stands out: It can contribute magnesium, but portion size and timing matter for people sensitive to stimulants.
15. Peanuts and Peanut Butter
Peanuts are an affordable and accessible source of magnesium.
They also provide protein, fiber and unsaturated fats, while peanut butter can be incorporated into breakfast and snacks.
Try it with:
- Whole-grain toast
- Oatmeal
- Apples
- Bananas
- Yogurt
- Smoothies
Easy way to use it
Spread a modest amount of peanut butter over whole-grain toast and add sliced banana.
Why they stand out: They’re inexpensive, widely available and easy to include regularly.

Magnesium Powerhouses vs Everyday Sources
Not all magnesium-rich foods need to play the same role in your diet.
Some foods are magnesium powerhouses because they provide a substantial amount in a relatively small serving.
Others are better thought of as everyday contributors.
Magnesium Powerhouses
- Pumpkin seeds
- Chia seeds
- Almonds
- Cashews
- Quinoa
Everyday Magnesium Sources
- Spinach
- Beans
- Edamame
- Oats
- Whole grains
- Brown rice
- Avocado
This doesn’t mean one group is “better.”
It simply gives you a practical way to think about your diet.
You can use seeds and nuts to boost magnesium intake, while beans, greens and whole grains can provide magnesium as part of regular meals.
Take-Home Message
The best magnesium-rich diet isn’t built around one superfood. Combine concentrated sources such as seeds and nuts with everyday foods such as beans, greens and whole grains.
How to Build a Magnesium-Rich Day
You don’t need to eat all 15 foods.
In fact, trying to do that would make your diet unnecessarily complicated.
Instead, build meals around a few different magnesium-containing food groups.
Breakfast
Oatmeal + chia seeds + almonds + fruit
Lunch
Quinoa + black beans + spinach + avocado
Snack
Pumpkin seeds or a small portion of peanuts
Dinner
Brown rice + tofu + leafy vegetables
Another simple option
Whole-grain toast + peanut butter + banana
Notice what is happening here.
We’re not relying on a single “magnesium food.”
We’re building variety across the day.
That is the more useful nutritional strategy.
Can Magnesium-Rich Foods Actually Improve Sleep?
This is the question behind the title, so it deserves an honest answer.
Maybe—but the evidence is not strong enough to promise it.
Research has identified a possible relationship between magnesium status and sleep, but that does not prove that eating more magnesium will improve sleep.
A systematic review of nine studies involving 7,582 adults found that observational studies generally suggested an association between magnesium status and sleep quality. However, randomized clinical trials showed contradictory results. The researchers concluded that larger and better-designed trials are needed.
This distinction is important.
What observational research tells us
People with different levels of magnesium intake or magnesium status may show differences in certain sleep measures.
That is interesting.
But observational studies cannot tell us whether magnesium caused the difference.
Other factors—diet quality, physical activity, health conditions, socioeconomic factors and overall lifestyle—can influence both magnesium intake and sleep.
What clinical trials tell us
Randomized trials are better for testing whether an intervention actually causes an outcome.
So far, the results have not been consistent enough to conclude that increasing magnesium intake reliably improves sleep in everyone.
Research on magnesium supplementation in older adults with insomnia has produced some encouraging findings, but the evidence has important limitations, including small sample sizes and low-quality evidence. That research also concerns supplements, not simply eating more magnesium-rich foods.
What we can reasonably say
Magnesium is essential for health.
Magnesium status may be related to sleep.
Magnesium-rich foods are nutritious ways to meet magnesium needs.
But:
Magnesium-rich foods have not been proven to treat insomnia.
That’s the evidence-based middle ground.
Take-Home Message
Eat magnesium-rich foods because they are nutritious—not because they’re guaranteed to make you sleepy.
The potential connection between magnesium and sleep is interesting, but the evidence is not yet strong enough for treatment claims.
Can You Get Enough Magnesium From Food?
For many people, a varied diet can provide substantial amounts of magnesium.
The NIH specifically identifies legumes, nuts, seeds, whole grains and green leafy vegetables as important food sources.
The advantage of food is that magnesium arrives as part of a broader nutritional package.
For example:
Almonds provide magnesium, protein, fiber and unsaturated fats.
Beans provide magnesium, protein and fiber.
Spinach provides magnesium alongside several vitamins and minerals.
Whole grains provide magnesium and fiber.
Seeds provide magnesium along with healthy fats and other minerals.
That is why it is useful to think about dietary patterns, rather than isolated nutrients.
Magnesium-Rich Foods Across Different Diets
You don’t need to follow a particular diet to eat more magnesium.
If you eat an Indian-style diet
Consider:
- Dal
- Rajma
- Chana
- Soybeans
- Nuts
- Seeds
- Whole grains
- Leafy greens
If you follow a Mediterranean-style pattern
Focus on:
- Legumes
- Nuts
- Seeds
- Whole grains
- Leafy vegetables
- Avocado and other plant foods
If you eat a plant-based diet
Seeds, nuts, legumes, tofu, whole grains and leafy greens can become particularly useful magnesium sources.
The principle is the same across diets:
Build variety around naturally magnesium-containing foods.
Does Cooking Affect Magnesium?
Cooking can change the nutrient composition of foods, and some magnesium can move into cooking water when foods are boiled.
That doesn’t mean you should avoid cooking vegetables or worry about losing every milligram.
If you boil magnesium-containing vegetables, using the cooking liquid in soups, stews or sauces can help retain nutrients that have moved into the water.
The bigger priority is simply eating a varied diet consistently.
Don’t let nutrient perfection get in the way of eating well.
Magnesium From Food vs Magnesium Supplements
Food and supplements shouldn’t be treated as interchangeable.
Food provides magnesium as part of a complete food.
Supplements provide a concentrated amount and may be useful in certain circumstances, but they also have different safety considerations.
The NIH sets an upper limit of 350 mg per day for magnesium from supplements and medications for adults. This limit does not apply to magnesium naturally present in food and beverages.
High supplemental intakes can cause:
- Diarrhea
- Nausea
- Abdominal cramping
Very high amounts can cause much more serious toxicity. The risk is also greater when kidney function is impaired because the body may have difficulty removing excess magnesium.
Magnesium supplements can also interact with some medications, including certain antibiotics and bisphosphonates.
Take-Home Message
Food is a practical way to meet your magnesium needs. Supplements are a separate issue and should be considered based on individual circumstances, dose and safety.
Can You Get Too Much Magnesium From Food?
For healthy people, magnesium naturally present in food and beverages is not considered a toxicity concern in the same way as large supplemental doses. The kidneys normally eliminate excess magnesium, and the NIH does not set an upper limit for magnesium naturally present in food.
The concern is mainly with supplements and magnesium-containing medications.
This is an important distinction because the number 350 mg is often misunderstood.
It does not mean:
“Never eat more than 350 mg of magnesium in a day.”
It means:
350 mg/day is the adult upper limit for magnesium from supplements and medications unless a healthcare professional advises otherwise.
What About Magnesium-Rich Foods Before Bed?
You don’t need to eat a magnesium-rich food immediately before sleeping.
Your magnesium status isn’t determined by a single bedtime snack.
Think about your overall daily diet instead.
If you’re genuinely hungry in the evening, a small nutritious snack may be reasonable:
- Yogurt with chia seeds
- A small portion of almonds
- Whole-grain toast with peanut butter
- Pumpkin seeds with fruit
But don’t assume that eating these foods immediately before bed will produce a measurable sleep effect.
And remember that dark chocolate contains caffeine and theobromine, so it may be less suitable late at night for people who are sensitive to stimulants.
Magnesium Is Only One Piece of Sleep
It’s easy to become focused on one nutrient when you’re trying to sleep better.
But sleep is much more complicated than that.
Your circadian rhythm, light exposure, sleep schedule, physical activity, stress, diet, medications, health conditions and sleep environment can all play a role.
Magnesium is one nutritional piece of this larger picture.
That is why a better strategy is:
Eat a varied diet. Meet your nutrient needs. Keep a consistent sleep schedule. Manage evening light exposure. Create a comfortable sleep environment.
Rather than searching for one “miracle” food, build several healthy habits that work together.
Frequently Asked Questions
Which food is highest in magnesium?
Seeds and nuts are among the most concentrated magnesium-rich foods, while legumes, whole grains and leafy greens are also important sources. Exact amounts vary by food, serving size and preparation.
What are the best magnesium-rich foods for sleep?
There isn’t enough evidence to rank individual foods according to their ability to improve sleep. A better approach is to regularly include a variety of seeds, nuts, legumes, whole grains and leafy greens.
Can magnesium-rich foods help you sleep better?
They can help you meet your magnesium needs, but research has not established that eating more magnesium reliably improves sleep. Observational research suggests a possible relationship, while randomized evidence remains uncertain.
How much magnesium do adults need each day?
Adult men generally need 400–420 mg per day, while adult women generally need 310–320 mg per day. Pregnancy increases the recommended intake.
Can you get enough magnesium from food?
A varied diet containing nuts, seeds, legumes, whole grains and leafy greens can provide substantial magnesium.
Is magnesium from food better than supplements?
Food is an excellent way to meet normal nutritional needs and provides other nutrients alongside magnesium. Supplements are more concentrated and have different safety considerations.
Is 350 mg the maximum magnesium you should consume?
No. The 350 mg upper limit applies to magnesium from supplements and medications, not magnesium naturally present in food.
Should you eat magnesium-rich foods before bed?
Not necessarily. Your overall dietary intake matters more than eating a particular magnesium-rich food immediately before bedtime.
Bottom Line
Magnesium-rich foods are an easy and nutritious way to increase your dietary magnesium.
The strongest food groups to focus on are seeds, nuts, legumes, whole grains and leafy greens. Pumpkin seeds, chia seeds, almonds, cashews, spinach, beans and quinoa are just some of the many options you can work into everyday meals.
There is also a scientifically interesting relationship between magnesium and sleep. Some research links magnesium status with sleep, but current clinical evidence does not prove that eating more magnesium will reliably improve sleep.
So don’t think of these foods as sleeping pills on a plate.
Think of them as nutrient-rich building blocks that can help you meet your body’s magnesium needs while improving the overall quality of your diet.
And for better sleep, remember the bigger picture: nutrition is one piece of the puzzle, not the whole puzzle.
Also Read: [Magnesium for Sleep: Does It Really Help?] | [10 Melatonin-Rich Foods for Better Sleep] | [How Your Body Produces Melatonin Naturally] | [Sleep and Tryptophan in Foods]
References
- National Institutes of Health, Office of Dietary Supplements. Magnesium — Fact Sheet for Consumers
- Arab A, Rafie N, Amani R, Shirani F. The Role of Magnesium in Sleep Health: A Systematic Review of Available Literature. Biological Trace Element Research. PubMed — Magnesium and Sleep Systematic Review
- U.S. Department of Agriculture, Agricultural Research Service. USDA FoodData Central
- National Institutes of Health, Office of Dietary Supplements. Magnesium — Health Professional Fact Sheet