You cleaned up your diet, cut the carbs, started losing weight, and then somewhere around week two you woke up at 3am with a calf cramp so savage it left you limping the next morning. Welcome to one of keto’s least glamorous rites of passage. Most people blame dehydration. A few blame electrolytes in some vague, hand-wavy way. What surprised me, when I actually dug into the physiology here, is how specifically magnesium is the culprit behind so many of keto’s most common complaints, and how badly the standard advice undershoots what people actually need.
Why Keto Drains Magnesium Faster Than You Think
Here’s the mechanism most keto guides skip over. When you reduce carbohydrates drastically, insulin levels drop. That’s the whole point. But insulin doesn’t just regulate blood sugar. It also signals your kidneys to retain sodium. When insulin falls, sodium excretion increases, and magnesium follows sodium out through urine because the two are linked in renal handling. You’re not just losing magnesium because you’re eating fewer magnesium-rich foods. You’re actively excreting more of it.
Layer on top of that the fact that many people starting keto are already walking in with suboptimal magnesium status. Population studies consistently show that a significant portion of adults in the US and UK don’t meet even the modest RDA of 310 to 420mg per day. So you’re often starting from behind and then accelerating the deficit.
I’ve seen clients who were diligent about electrolytes, salting their food, taking sodium supplements, and still experiencing symptoms, because they were chasing sodium and ignoring magnesium entirely. The two problems can look similar on the surface. The fix is not the same.
What Low Magnesium Actually Feels Like on Keto
The symptom list here is frustratingly broad, which is part of why magnesium deficiency gets missed. But there are patterns I’ve noticed clinically that tend to cluster together:
Muscle cramps and twitching are the most dramatic. The calf cramp at 3am is the classic presentation, but eye twitches (called myokymia) and general muscle tension are also common. Magnesium is essential for muscle relaxation. Without enough, muscles contract more easily and struggle to release.
Sleep disruption is underappreciated. Magnesium plays a role in regulating GABA, an inhibitory neurotransmitter that quiets the nervous system. Low magnesium can mean lighter sleep, more wakefulness, and that wired-but-tired feeling that some people wrongly attribute to keto adaptation itself.
Constipation is another one. Keto can already slow things down for some people due to changes in fiber intake and gut microbiome. Magnesium deficiency makes it worse because the mineral draws water into the intestines and supports smooth muscle contraction. This is actually the mechanism behind magnesium-based laxatives.
Anxiety and headaches round out the picture. The research here is mixed and I won’t oversell it, but magnesium has a well-established role in nervous system regulation, and several studies have found correlations between low magnesium and both headache frequency and anxiety symptoms.
If you’re experiencing two or more of these during keto adaptation, magnesium is worth taking seriously before assuming it’s just “the keto flu.”
Not All Magnesium Supplements Are Equal
| Form | Bioavailability | Best For | Notes |
|---|---|---|---|
| Magnesium oxide | Low (~4%) | Nothing really | Cheap, widely sold, poorly absorbed |
| Magnesium citrate | Moderate-high | General supplementation, constipation | Good starting point for most people |
| Magnesium glycinate | High | Sleep, anxiety, sensitive stomachs | Least likely to cause loose stools |
| Magnesium malate | Moderate-high | Muscle function, fatigue | Often used by athletes |
| Magnesium threonate | High (brain-specific) | Cognitive support | Newer research, more expensive |
| Magnesium chloride (topical) | Variable | Sore muscles (transdermal) | Useful adjunct, not a full replacement |
This is where I’ll be honest: the supplement aisle is a disaster of poorly labeled products, and most people default to the cheapest option, which is usually magnesium oxide. That’s a problem.
Here’s a quick comparison of the main forms you’ll encounter:
| Form | Bioavailability | Best For | Notes |
|---|---|---|---|
| Magnesium oxide | Low (~4%) | Nothing really | Cheap, widely sold, poorly absorbed |
| Magnesium citrate | Moderate-high | General supplementation, constipation | Good starting point for most people |
| Magnesium glycinate | High | Sleep, anxiety, sensitive stomachs | Least likely to cause loose stools |
| Magnesium malate | Moderate-high | Muscle function, fatigue | Often used by athletes |
| Magnesium threonate | High (brain-specific) | Cognitive support | Newer research, more expensive |
| Magnesium chloride (topical) | Variable | Sore muscles (transdermal) | Useful adjunct, not a full replacement |
For most people on keto, I recommend starting with magnesium glycinate or magnesium citrate. Glycinate is gentler on digestion and works well for the sleep and cramping issues. Citrate is effective and affordable. The dose that tends to matter is 200 to 400mg of elemental magnesium per day, taken in divided doses if possible, and often best at night since it tends to support sleep.
A product like Thorne Magnesium Bisglycinate is a solid, third-party tested option. (Disclosure: this site may earn a commission on qualifying purchases.)
How to Get More Magnesium From Food First
Supplementing is practical and often necessary on keto. But it’s worth knowing which whole foods deliver meaningful magnesium without blowing your carb budget, because getting nutrients from food first is still the better default.
The good news: several high-magnesium foods are genuinely keto-friendly.
- Pumpkin seeds (pepitas): About 150mg per ounce, and roughly 4g net carbs. One of the best bang-for-your-buck sources.
- Dark chocolate (85%+): Around 65mg per ounce. Yes, this counts.
- Almonds: About 80mg per ounce, with approximately 2.5g net carbs.
- Spinach (cooked): Around 78mg per half cup. Cooked spinach is much more practical than raw for volume.
- Avocado: About 58mg per whole fruit, and it’s already on most keto plates.
- Mackerel and salmon: Meaningful magnesium plus the omega-3 benefits.
The harder reality is that hitting 350 to 400mg from food alone while keeping carbs under 20 to 30g is genuinely difficult. Most of my clients who are doing keto seriously end up needing at least a partial supplement. That’s not a failure, it’s just the math.
A Practical Protocol for Getting Magnesium Right on Keto
Sources
- Thorne Magnesium Bisglycinate
- kitchen scale
- electrolyte supplement that includes magnesium
- Nataliya Vaitkevich
- here is mixed and I won’t oversell it
If you’re dealing with symptoms right now, here’s what I’d actually walk through with a client:
Audit your current intake. Use Cronometer (free version is fine) and log three days of eating. Most people are shocked at how far below target they are.
Choose the right form. If you have sleep issues or anxiety as your primary complaint, start with magnesium glycinate, 200mg at night. If constipation and cramping are the main issues, magnesium citrate 200 to 300mg in the evening is a reasonable starting point.
Don’t take it all at once. Large single doses are more likely to cause loose stools and are absorbed less efficiently. Split doses: morning and night if you’re taking 400mg total.
Give it two weeks. Intracellular magnesium levels don’t normalize overnight. Most people see meaningful symptom change within 10 to 14 days of consistent supplementation.
Watch for interactions. If you take medications for blood pressure, heart arrhythmia, or diabetes, check with your doctor before supplementing. Magnesium has real physiological effects and isn’t consequence-free in certain clinical situations.
Track a few key symptoms. Rate your sleep quality, cramp frequency, and constipation on a simple 1-10 scale before you start. It makes it much easier to know whether what you’re doing is actually working.
A quality kitchen scale can help you accurately portion magnesium-rich foods like seeds and nuts when you’re tracking intake. And if you want to keep electrolytes balanced more broadly, an electrolyte supplement that includes magnesium rather than just sodium and potassium can simplify the whole process. (Disclosure: this site may earn a commission on qualifying purchases.)
Magnesium isn’t the most exciting topic in the keto space. It doesn’t get the attention that macros and ketone tracking do. But in my experience, it’s the single nutrient most likely to explain why someone feels noticeably better or noticeably worse on a well-formulated low-carb diet. Getting it right won’t guarantee results, but getting it wrong creates a drag on everything else you’re trying to do. Worth the attention.
Photo: Nataliya Vaitkevich via Pexels
This article is for general informational purposes only and does not constitute medical or dietary advice. Always consult a licensed healthcare provider or registered dietitian before making significant changes to your diet, especially if you have a medical condition.
Jake Torres





