Quick summary
- Per realistic portion, seeds lead: 3 tbsp of hemp seeds give 210 mg and 1 oz of roasted pumpkin seeds 154 mg, both for under 2.5 g of net carbs.
- The NIH adult RDA is 420 mg a day for men and 320 mg for women (age 31 and over). Every percentage below uses those two numbers.
- Keto-friendly picks with real magnesium: hemp and pumpkin seeds, chia, almonds, boiled spinach and firm tofu. Black beans and cashews have it too, but cost more carbs.
- One sample day of six portions reaches about 457 mg for roughly 10 g of net carbs.
- The 350 mg upper limit applies to magnesium from supplements and medicines only, not food. It is a safety ceiling, not a target.
Educational summary, not medical advice. Sources: in the text and at the end.
Evidence box
| Evidence type | USDA food-composition data for the numbers; the NIH Office of Dietary Supplements fact sheet for needs, limits and interactions; a systematic review and a cross-sectional study on low-carb diets; a Cochrane review on cramps. |
| How certain | High for the food numbers and the RDA. Low to moderate for how much keto itself changes magnesium intake. |
| What we know | Which everyday foods give the most magnesium per portion, what a portion costs in net carbs, and who should be careful with supplements. |
| What we don’t know yet | Whether people on keto end up low in magnesium in the long run: the studies are small and point in different directions. |
| Evidence checked | October 2026 |
محتوى المقالة
The foods highest in magnesium per realistic portion are seeds and nuts: three tablespoons of hemp seeds give 210 mg, half of an adult man’s 420 mg a day, and an ounce of pumpkin seeds gives 154 mg. Boiled spinach, tofu, almonds and chia follow close behind.
Most magnesium lists stop there. This one puts the net carbs per portion next to every number, because on keto the best source is the one that fits your carb budget. Half a cup of black beans has a respectable 60 mg, but it also costs 12.9 g of net carbs. If you’re new to low-carb eating, what the keto diet actually is explains the basics, and the keto macro calculator gives you your own daily carb number.
Why magnesium comes up so often on keto
Magnesium is a working mineral. According to the NIH Office of Dietary Supplements (ODS), an adult body holds about 25 g, 50–60% of it in bone, and it is a cofactor in more than 300 enzyme systems. Less than 1% sits in blood serum, where the body keeps the level under tight control.
ODS lists the main food sources as green leafy vegetables, legumes, nuts, seeds and whole grains. Keto cuts two of those five, grains and most legumes. Refining grains already strips much of their magnesium, so beans and whole grains are the real loss.
Harvard’s Nutrition Source advises a daily variety of allowed foods on keto to get enough fiber, B vitamins and minerals, magnesium among them.
You’ll also see magnesium sold as a “keto flu” fix. Harvard describes early low-carb symptoms such as fatigue, headaches, irritability and brain fog that can last days to weeks. We found no trial that tested magnesium for those symptoms, so we don’t claim it helps. Food first is the safe default.
Foods high in magnesium, ranked per portion
Each number is a real portion, not 100 g. “% RDA” uses the NIH RDA for adults aged 31 and over: 420 mg for men and 320 mg for women. For ages 19–30 the RDAs are slightly lower, 400 mg and 310 mg. We count 1 oz as 28 g. Net carbs = total carbohydrate − fiber, as on US labels.
| Food | Portion | Magnesium | % RDA, men | % RDA, women | Net carbs |
|---|---|---|---|---|---|
| Hemp seeds (hemp hearts) | 3 tbsp (30 g) | 210 mg | 50% | 66% | 1.4 g |
| Pumpkin seeds (pepitas), roasted | 1 oz (28 g) | 154 mg | 37% | 48% | 2.3 g |
| Chia seeds | 1 oz (28 g) | 94 mg | 22% | 29% | 2.2 g |
| Cashews | 1 oz (28 g) | 82 mg | 19% | 26% | 7.5 g |
| Spinach, boiled | ½ cup (90 g) | 78 mg | 19% | 24% | 1.2 g |
| Almonds | 1 oz (28 g) | 76 mg | 18% | 24% | 2.5 g |
| Tofu, firm (calcium-set) | ½ cup (126 g) | 73 mg | 17% | 23% | 0.6 g |
| Dark chocolate, 70–85% | 1 oz (28 g) | 64 mg | 15% | 20% | 9.8 g |
| Black beans, boiled | ½ cup (86 g) | 60 mg | 14% | 19% | 12.9 g |
| Flaxseed, ground | 2 tbsp (14 g) | 55 mg | 13% | 17% | 0.2 g |
| Peanuts | 1 oz (28 g) | 47 mg | 11% | 15% | 2.1 g |
| Avocado | ½ avocado (100 g) | 29 mg | 7% | 9% | 1.8 g |
| Salmon, Atlantic, farmed, cooked | 3 oz (85 g) | 26 mg | 6% | 8% | 0.0 g |
| Spinach, raw | 1 cup (30 g) | 24 mg | 6% | 7% | 0.4 g |
Source: USDA FoodData Central (SR Legacy), scaled to the portion shown; percentages use the unrounded USDA values. RDA: NIH Office of Dietary Supplements, Table 1.
A few things jump out. Seeds dominate: hemp, pumpkin and chia all beat every nut per portion. Boiled spinach (78 mg per half cup) does far better than raw (24 mg per cup), because cooking shrinks a big pile of leaves into a small portion. And firm, calcium-set tofu gives 73 mg for just 0.6 g of net carbs.
Two foods are good sources but expensive in carbs: dark chocolate (64 mg for 9.8 g per ounce) and black beans (60 mg for 12.9 g). Cashews sit between them at 7.5 g per ounce. Salmon has almost no carbs, but at 26 mg per 3 oz it is a modest source.
Databases differ a little: the ODS food table lists 111 mg for an ounce of chia (a different USDA entry) against our 94 mg.
The keto shortlist: most magnesium for the fewest carbs
Plot magnesium against net carbs and the picture is clear. Everything in the top-left corner gives a lot of magnesium for very few carbs. The dashed line marks 3 g of net carbs, the “green” limit on our keto food list. The chart’s scale runs from 0 to 14 g of net carbs and from 0 to 50% of the men’s RDA.
A day that reaches the RDA on about 10 g of net carbs
Here is one ordinary keto day built only from foods in the table. No supplements, nothing unusual.
| Meal | Food and portion | Magnesium | Net carbs |
|---|---|---|---|
| Breakfast | Chia seeds, 1 oz (28 g) | 94 mg | 2.2 g |
| Lunch | Avocado, ½ avocado (100 g) | 29 mg | 1.8 g |
| Lunch | Pumpkin seeds (pepitas), roasted, 1 oz (28 g) | 154 mg | 2.3 g |
| Dinner | Salmon, Atlantic, farmed, cooked, 3 oz (85 g) | 26 mg | 0.0 g |
| Dinner | Spinach, boiled, ½ cup (90 g) | 78 mg | 1.2 g |
| Snack | Almonds, 1 oz (28 g) | 76 mg | 2.5 g |
| Total | 457 mg | 10.0 g |
Source: USDA FoodData Central (SR Legacy), per the portions shown; totals add the rounded values.
That day gives about 457 mg: 109% of the men’s RDA and 143% of the women’s, for 10.0 g of net carbs. The ounce of pumpkin seeds on the salad does a third of the work on its own.
The carbs leave room in a 20 g day for the rest of your meals. Our 7-day keto meal plan shows how these foods fit around eggs, meat and other vegetables.
Is magnesium deficiency common?
It depends on what you mean. Low intake is common; symptomatic deficiency is not. ODS reports that 48% of Americans of all ages get less magnesium from food and drinks than their estimated average requirement. Men aged 71 and over and teenagers are the most likely to fall short.
But ODS also says symptomatic magnesium deficiency from low intake is uncommon in otherwise healthy people, because the kidneys cut how much they lose in urine. The groups at higher risk are people with gut diseases such as Crohn’s or celiac disease, people with type 2 diabetes (high blood glucose raises magnesium loss in urine), people with alcohol dependence, and older adults, who absorb less and excrete more.
For information only, these are the signs ODS lists. Early: loss of appetite, nausea, vomiting, fatigue and weakness. As it worsens: numbness, tingling, muscle cramps, seizures and abnormal heart rhythms. These signs have many other causes. If you have them, see a doctor rather than guessing.
ODS also notes that blood levels don’t accurately reflect total body magnesium, so a proper assessment may need lab tests and a clinical exam.

What does the evidence actually say?
On keto and magnesium intake, the evidence is thin and mixed. A 2019 systematic review in Obesity Reviews (Churuangsuk and colleagues) found only 10 studies of carbohydrate-restricted diets that measured micronutrients. Across diet types, intakes of magnesium, thiamine, folate, calcium, iron and iodine fell, by 10% to 70% from baseline. No study reported a diagnosed deficiency. Its limitation: few, small, varied studies, mostly Atkins-style, and intake estimates rather than body stores.
A 2024 cross-sectional study in the European Journal of Nutrition by the same group compared 49 adults on low-carb diets with 49 who weren’t restricting carbs. It found no significant difference in magnesium intake or blood magnesium between groups. Its limitation: a snapshot of 98 volunteers, many already taking supplements, so it can’t show cause and effect.
On cramps, magnesium supplements look weak. A 2020 Cochrane review (Garrison and colleagues) pooled 11 trials with 735 people. For ordinary night-time leg cramps, mostly in older adults, magnesium did not meaningfully reduce cramps compared with placebo. Evidence for cramps in pregnancy was conflicting, and the authors found no trials on exercise-related cramps. Mild stomach side effects such as diarrhea were the main downside.
What we don’t claim: this article makes no claims about magnesium and sleep, mood or anxiety. The ODS fact sheet doesn’t cover them, and we haven’t reviewed that trial evidence here.
Supplements, the upper limit, and who should be careful
Magnesium supplements exist in several forms, and some medicines contain magnesium too. We don’t recommend a dose or a form; that is a decision for you and your doctor or pharmacist. What you should know is the safety ceiling.
The 350 mg number is a ceiling, not a target, and it isn’t about food. The NIH Tolerable Upper Intake Level of 350 mg a day for adults covers magnesium from supplements and medicines only. Magnesium from food and drinks isn’t counted, so the 457 mg day above is not “over the limit”.
Too much supplemental magnesium can cause diarrhea, nausea and stomach cramps. Very high intakes from supplements or medicines can cause low blood pressure, an irregular heartbeat and, rarely, fatal toxicity.
Kidney disease is the big caution. ODS says the risk of magnesium toxicity rises with impaired kidney function or kidney failure, because the kidneys are what clear the excess. If you have kidney disease, talk to your doctor before taking any magnesium supplement or magnesium-containing medicine.
If you take medication
Magnesium, mostly from supplements, interacts with several common medicines. The ODS fact sheet lists these:
- Bisphosphonates (osteoporosis drugs taken by mouth): magnesium can reduce how much of the drug you absorb, so the two are taken hours apart.
- Some antibiotics (tetracyclines and quinolones): magnesium binds them in the gut. The fact sheet gives spacing of several hours. Your pharmacist can confirm the timing for your prescription.
- Diuretics: loop and thiazide diuretics can increase magnesium loss in urine, while potassium-sparing ones (such as amiloride and spironolactone) reduce it.
- Proton pump inhibitors (PPIs) for reflux: taken for a long time, typically more than a year, they can cause low blood magnesium. The FDA has advised doctors to consider checking magnesium before long-term use.
Separately, the keto diet itself changes how some diabetes medicines work (StatPearls clinical review, in Sources): if you take insulin or a sulfonylurea, a very-low-carb diet can push blood sugar too low, so your prescriber needs to plan any change before you start. If you take an SGLT2 inhibitor (the “-flozin” drugs), keto is generally advised against because of the risk of ketoacidosis.
Never change a dose or stop a medicine on your own.
Frequently asked questions
What food is highest in magnesium?
Per realistic portion in our table, hemp seeds (3 tbsp, 210 mg) and roasted pumpkin seeds (1 oz, 154 mg) lead. Per 100 g, hemp seeds have 700 mg. Chia, boiled spinach, cashews, almonds and tofu are also strong sources.
Is magnesium deficiency common?
Low intake is common: ODS reports that 48% of Americans eat less than their estimated average requirement. Symptomatic deficiency is uncommon in healthy people because the kidneys conserve magnesium. Gut diseases, type 2 diabetes, alcohol dependence and older age raise the risk.
Do magnesium and vitamin D work together?
They are linked. The NIH fact sheet says magnesium affects the levels of parathyroid hormone and of the active form of vitamin D. That doesn’t mean you need to take them together; ask your doctor if you are being treated for low vitamin D.
Does keto cause low magnesium?
Not necessarily. A systematic review found magnesium intake tends to fall on carb-restricted diets, but a 2024 study found no difference in blood magnesium between low-carb eaters and others. Choosing seeds, nuts, leafy greens and tofu keeps intake up.
Is dark chocolate a good source of magnesium?
Yes, but carb-heavy for keto. One ounce of 70–85% dark chocolate has 64 mg and 9.8 g of net carbs. An ounce of pumpkin seeds gives more than twice the magnesium for a quarter of the carbs.
Can you get too much magnesium from food?
Not from food, for healthy people: the 350 mg upper limit applies only to supplements and medicines. People with kidney disease are the exception, and should follow their doctor’s advice on all sources.
Medical disclaimer
This article is for education only and is not a substitute for advice from your doctor or a registered dietitian. Food values are averages from a national database and real foods vary. Magnesium supplements can interact with medicines and are not safe for everyone, especially people with kidney disease. If you take medication for diabetes or blood pressure, are pregnant or breastfeeding, have kidney, liver or pancreatic disease, or a history of disordered eating, talk to your doctor before changing how you eat. Never change a dose or stop a medicine on your own.
Sources
- National Institutes of Health, Office of Dietary Supplements. Magnesium: Fact Sheet for Health Professionals. NIH ODS (updated 6 January 2026), 2026.
- U.S. Department of Agriculture, Agricultural Research Service. FoodData Central: SR Legacy. USDA FoodData Central (FDC IDs 170148, 170557, 170554, 170162, 168463, 170567, 172475, 170273, 173735, 169414, 172430, 171705, 175168, 168462), 2018.
- Churuangsuk C, Griffiths D, Lean MEJ, Combet E. Impacts of carbohydrate-restricted diets on micronutrient intakes and status: a systematic review. Obesity Reviews 20(8):1132–1147, PMID 31006978, 2019.
- Churuangsuk C, Catchpole A, Talwar D, Welsh P, Sattar N, Combet E, Lean MEJ. Low thiamine status in adults following low-carbohydrate / ketogenic diets: a cross-sectional comparative study of micronutrient intake and status. European Journal of Nutrition 63(7):2667–2679, PMID 38967675, 2024.
- Garrison SR, Korownyk CS, Kolber MR, et al. Magnesium for skeletal muscle cramps. Cochrane Database of Systematic Reviews, CD009402, 2020.
- The Nutrition Source, Harvard T.H. Chan School of Public Health. Diet Review: Ketogenic Diet for Weight Loss. Harvard T.H. Chan (updated 5 September 2025), 2025.
- Daley SF, Masood W, Annamaraju P, Khan Suheb MZ. The Ketogenic Diet: Clinical Applications, Evidence-based Indications, and Implementation. StatPearls, NCBI Bookshelf NBK499830 (updated 13 December 2025), 2025.
Last reviewed: 24 October 2026 · TheKetoLand Editorial · How we make our content
