Muscle cramps during or after exercise are one of the most common complaints among athletes, regardless of the sport. Sudden pain, involuntary muscle contraction: a cramp can ruin an entire workout or disrupt a night's sleep. But what is the real cause, and especially how can they be effectively prevented? Magnesium, often underestimated, plays a central role in this story, as do hydration and overall electrolyte balance.
Why do muscle cramps occur during sports?
Electrolyte loss through sweating
When you sweat, you don’t just lose water. Your sweat contains essential minerals like sodium, potassium, and magnesium, collectively called electrolytes. These minerals are essential for proper neuromuscular function: they regulate communication between nerves and muscles and allow your muscle fibers to contract and then relax properly.
When their concentration drops too quickly, muscle coordination is disrupted. The muscle then receives contraction signals without being able to relax normally, causing cramps. Prolonged effort, excessive heat, or insufficient hydration accelerate this phenomenon. That’s why cramps are more frequent during summer competitions, late-season matches, or long outings.
Magnesium deficiency: a frequently overlooked factor
Magnesium is one of the most commonly deficient minerals in the European population. A key French study (SU.VI.MAX) showed that over 70% of adults have magnesium intakes below the daily recommendations (375 mg per day). This deficit is even more pronounced in physically active people, as exercise increases magnesium losses through sweat and urine.
Magnesium deficiency often manifests as nighttime calf cramps, muscle tremors, persistent fatigue, and increased nervousness. If you regularly experience cramps outside of intense effort, it is likely that your magnesium intake is insufficient.
Magnesium and muscles: how it works
The role of magnesium in muscle contraction and relaxation
Magnesium acts as a natural antagonist to calcium in muscle cells. Calcium causes contraction, magnesium allows relaxation. Without sufficient magnesium intake, the muscle remains in a state of partial contraction, which promotes cramps, spasms, and chronic tension.
More specifically, magnesium is involved in ATP production (the energy molecule of cells), regulation of intracellular calcium, and nerve impulse transmission. Even a slight deficiency can affect both athletic performance and muscle recovery.
Magnesium and potassium: an essential duo for athletes
Potassium works closely with magnesium to maintain the electrolyte balance of cells. Adequate potassium intake helps maintain proper osmotic pressure in muscle cells, facilitating nutrient entry and elimination of metabolic waste produced during exercise.
Endurance athletes and those who practice sports with many accelerations (football, basketball, tennis) are particularly exposed to combined potassium and magnesium deficiency. A good strategy is to cover these needs primarily through diet and supplement if necessary with a drink or supplement containing both minerals in a well-absorbed form.
How to naturally prevent muscle cramps
Magnesium-rich diet: foods to prioritize
The first line of defense against cramps is diet. The richest dietary sources of magnesium are pumpkin and sunflower seeds, almonds and cashews, dark chocolate (at least 70%), legumes (lentils, chickpeas), whole grains, and leafy green vegetables like spinach and chard.
For potassium, it is abundant in bananas, avocados, sweet potatoes, white beans, and dried fruits. Regularly including these foods in your diet provides a solid base to cover your electrolyte needs, especially if you practice sports several times a week.
Hydration and electrolytes: before, during, and after exercise
Beyond diet, hydration plays a fundamental role in preventing cramps. Drinking enough water before, during, and after exercise helps maintain blood volume, facilitates electrolyte transport to muscles, and eliminates metabolic waste that accumulates during exercise.
During efforts longer than an hour or in hot conditions, drinking pure water is not always enough. The body needs to recover electrolytes lost through sweat, especially sodium, potassium, and magnesium. This is where an electrolyte-enriched hydration drink can make a difference by helping maintain the body's mineral balance during and after exercise.
Night cramps: a particular case to understand
Night cramps, especially in the calves, affect a large portion of the adult population. They most often occur in the second half of the night and can be very painful. Several factors can trigger or worsen them: sedentary lifestyle, chronic dehydration, certain medications (notably diuretics), and of course magnesium deficiency.
To remedy this, several simple habits have proven effective: stretching the calves before bed, ensuring good hydration throughout the day, and if necessary, considering a magnesium course for 1 to 3 months. The forms of magnesium best absorbed by the body are bisglycinate, citrate, and malate, preferred over oxide and chloride forms which are less well absorbed.
FAQ: your questions about cramps and magnesium
Why do I only get cramps at night?
Night cramps are often linked to a combination of factors: magnesium deficiency, poor venous circulation in the legs, sleeping posture compressing certain nerves, or cumulative dehydration during the day. They are not directly related to physical effort, unlike training cramps. If they are frequent, it is best to consult a doctor to rule out an underlying cause.
How much magnesium should I take daily to avoid cramps?
The recommended daily intake of magnesium is 375 mg for an adult. In case of recurrent cramps, some health professionals recommend a temporary supplementation of 200 to 400 mg per day, in addition to dietary intake. A course of 4 to 8 weeks is usually enough to compensate for a deficiency. It is best not to exceed 500 mg per day of supplementation without medical advice.
Do bananas really help against cramps?
Bananas are rich in potassium (about 400 mg per fruit), which makes them useful for cramps related to potassium deficiency. But they contain little magnesium. If your cramps are mainly due to magnesium deficiency, bananas alone will not be sufficient. Combining several foods rich in different electrolytes is always more effective than a single food.
Are stretches enough to prevent cramps?
Regular stretching improves muscle flexibility and can reduce the frequency of cramps by decreasing residual muscle tension. But it does not compensate for an electrolyte deficiency. Stretching and hydration are complementary and should go hand in hand for effective cramp prevention, especially in regular athletes.
What should I do immediately when a cramp occurs?
When a cramp occurs, the first thing to do is gently stretch the affected muscle: for a calf cramp, flex your foot toward you by pulling on the toes. Massage the area gently to promote blood circulation. If the pain persists, a warm compress can help relax the muscle. After the episode, hydrate yourself and plan an electrolyte intake for the rest of your day.
The takeaway message
Muscle cramps are not inevitable. A diet rich in magnesium and potassium, combined with good hydration and electrolyte intake adapted to your activity level, is sufficient in the vast majority of cases to effectively prevent them. Start by adjusting your diet and paying particular attention to your water consumption around your workouts: results are often felt within just a few weeks.


