Keto Electrolytes: Why They Matter and How to Get Enough
Keto electrolytes guide: why low-carb depletes sodium, potassium, and magnesium, how to replace them, and how to avoid the keto flu.
Head of Nutrition · June 11, 2026 · 6 min read

On keto, your body sheds water and minerals as insulin drops, so you need more sodium, potassium, and magnesium than you did on a higher-carb diet. Getting enough prevents the "keto flu" — the fatigue, headaches, and muscle cramps that hit many people in their first week. Aim for adequate salt, potassium-rich low-carb foods, and magnesium daily.
That single shift — replacing electrolytes instead of ignoring them — is the difference between a miserable first week and a smooth transition into ketosis. Here's exactly what to replace, how much, and where to find it in food.
| Electrolyte | Why it matters on keto | Rough daily target | Keto food sources |
|---|---|---|---|
| Sodium | Lost fastest as insulin falls; low levels cause headaches, fatigue, and brain fog | 4,000–6,000 mg | Salt, broth, pickles, olives, cured meats, salted nuts |
| Potassium | Works with sodium for hydration, muscle, and heart rhythm; cramps signal a shortfall | 3,000–4,000 mg | Avocado, spinach, salmon, mushrooms, zucchini |
| Magnesium | Supports muscle relaxation, sleep, and energy; low levels worsen cramps and restless legs | 300–400 mg | Pumpkin seeds, almonds, dark leafy greens, dark chocolate |
Targets are general guidance for healthy adults. If you have kidney issues, heart conditions, or take blood pressure medication, talk to your doctor before loading up on sodium or potassium.
Why keto depletes electrolytes
On a standard diet, higher insulin tells your kidneys to hold onto sodium. When you cut carbs, insulin drops — and so does that retention signal. Your kidneys start excreting sodium, and water follows it out. This is why people often drop several pounds of water weight in the first week of keto.
The catch is that the water you lose carries dissolved minerals with it. Sodium leaves first, and potassium and magnesium go along for the ride. Lose enough without replacing them and you feel it fast: the headaches, sluggishness, dizziness on standing, and leg cramps that get lumped together as the "keto flu."
The good news is that the keto flu is almost entirely an electrolyte problem, not a sign that keto is wrong for you. Replace what you're losing and most symptoms fade within a day or two. For a full symptom-by-symptom breakdown, see our keto-flu guide.
The 3 key electrolytes
Sodium
Sodium is the one most people get wrong, because they've spent years being told to eat less of it. On keto the math flips — you're excreting more, so you need to replace more. Under-eating sodium is the single most common cause of low energy in the first weeks.
Salt your food without guilt, sip salted water or broth when you feel foggy, and don't fear "salty" whole foods like olives and pickles. If you get a headache mid-afternoon, a glass of water with a quarter-teaspoon of salt often clears it within twenty minutes.
Potassium
Potassium partners with sodium to manage hydration and keep your muscles and heart firing properly. It's hard to hit the target with supplements alone (potassium pills are capped at small doses for safety), so food is the practical route.
The standouts are avocado, leafy greens, salmon, and mushrooms — all of which fit comfortably in a low-carb day. One avocado delivers roughly 700–900 mg of potassium for only a couple of grams of net carbs.
Magnesium
Magnesium is the quiet one. Many people are low on it before they ever try keto, and the diet's water loss can deepen the gap. Symptoms of a shortfall include muscle cramps, twitchy eyelids, restless legs at night, and poor sleep.
Pumpkin seeds, almonds, spinach, and dark chocolate (85%+) are strong food sources. Because magnesium is genuinely hard to get enough of from food, it's the electrolyte most people end up supplementing — more on that below.
Best food sources of electrolytes on keto
You can cover most of your needs without a single supplement if you build meals around mineral-dense foods:
- Avocado — a potassium powerhouse and a keto staple. See the full avocado nutrition breakdown for carb counts.
- Leafy greens — spinach, kale, and chard deliver potassium and magnesium with almost no carbs. They're near the top of our lowest-carb vegetables list.
- Nuts and seeds — almonds, macadamias, and especially pumpkin seeds bring magnesium plus healthy fat.
- Salt — the simplest fix of all. Sea salt or pink salt on your food, and a pinch in your water, covers sodium effortlessly.
- Bone broth — a fast, warming way to get sodium and potassium together, especially on a rough day or while fasting.
- Fatty fish — salmon and sardines add potassium and magnesium alongside protein and omega-3s.
A simple habit: include one potassium-rich food and one magnesium-rich food at most meals, and salt to taste. Logging those meals in CarbMeNot makes it easy to see whether your day is actually landing on these foods or just feeling like it is.
Should you supplement?
Whole foods plus added salt cover most people. Supplements are worth considering when:
- You train hard or sweat heavily, which accelerates electrolyte loss.
- You're fasting or eating very few meals, leaving little room for food sources.
- You still feel run down after several days of eating mineral-rich keto foods.
- You struggle to hit magnesium from food alone — the most common gap.
If you supplement, magnesium glycinate or citrate are gentle, well-absorbed options usually taken in the evening. Potassium is better filled with food than pills. And an unflavored electrolyte powder or a simple salted drink can rescue a bad afternoon quickly. There's no need to over-engineer it — food first, salt freely, and patch the gaps.
Signs you need more electrolytes
Your body gives clear signals. Watch for:
- Headaches that show up in your first keto week (usually sodium).
- Fatigue or brain fog that doesn't match your sleep.
- Muscle cramps, especially in your calves at night (potassium and magnesium).
- Dizziness or lightheadedness when you stand up quickly (sodium and hydration).
- Heart palpitations or a racing feeling at rest (often potassium or magnesium).
- Constipation, which magnesium can help relieve.
Most of these resolve fast once you replace what's missing. If palpitations or severe symptoms persist, see a doctor — but for the vast majority, a salty broth and an avocado are the whole prescription.
Track the foods that keep you balanced
Electrolytes are easy to neglect because they're invisible until something goes wrong. CarbMeNot lets you snap a photo or search a food and instantly see its carbs alongside the foods that carry your sodium, potassium, and magnesium — so you can build days that keep you in ketosis and feeling good. Use it to confirm you're actually eating the avocado, greens, and salted whole foods your body needs, not just intending to.
Key takeaways
- Keto lowers insulin, which makes you excrete water plus sodium, potassium, and magnesium — replacing them is how you beat the keto flu.
- Salt your food generously; under-eating sodium is the most common cause of low energy on keto.
- Get potassium from avocado, spinach, and salmon, and magnesium from nuts, seeds, and leafy greens.
- Supplements are optional — useful for hard training, fasting, or stubborn magnesium gaps, but food and salt cover most people.
- Watch for headaches, cramps, fatigue, and dizziness as your cue to top up, and track your intake in CarbMeNot to stay ahead of it.
Frequently asked questions
- Why are electrolytes important on keto?
- When you cut carbs, insulin drops and your kidneys flush out water along with sodium, potassium, and magnesium. Replacing these minerals prevents the fatigue, headaches, and cramps known as the keto flu, and keeps your energy and hydration stable.
- What electrolytes do you need on keto?
- The three that matter most are sodium, potassium, and magnesium. Sodium is the one you lose fastest and the easiest to under-eat, while potassium and magnesium support muscle, nerve, and heart function and are commonly low on any modern diet.
- How do you get electrolytes on keto?
- Salt your food generously, eat potassium-rich low-carb foods like avocado, spinach, and salmon, and include magnesium sources such as nuts, seeds, and leafy greens. Bone broth and salted water help on tough days.
- Do you need electrolyte supplements on keto?
- Not always. Most people can cover their needs with food and added salt. Supplements help if you train hard, sweat a lot, fast, or still feel run down after a few days of eating mineral-rich keto foods.
Track it all in seconds
Snap a photo and CarbMeNot's AI logs your carbs, protein, and fat automatically.