Almost everyone who trains has felt it: a calf that suddenly locks up in the middle of a run, a hamstring that seizes during a set, or a cramp that wakes you at night. Muscle cramps are common, painful and often blamed on "low magnesium" or "not enough salt". The real picture is more nuanced.
This guide looks at why exercise-related cramps happen, what the research says about the usual suspects, and the practical nutrition and training habits worth focusing on, including where magnesium and potassium fit in.
What is a muscle cramp?
A muscle cramp is a sudden, involuntary and painful contraction of a muscle or part of a muscle. It usually lasts from a few seconds to a few minutes. The calves, hamstrings, quadriceps and feet are the most common spots.
Exercise-associated muscle cramps (often shortened to EAMC) happen during or shortly after exercise. Night cramps are a separate, very common issue, especially as people get older, and they don't always have an obvious cause.
Why do cramps happen during exercise?
Researchers have two main explanations, and they are not mutually exclusive.
1. Neuromuscular fatigue
The most widely supported theory is that fatigue disrupts the balance of nerve signals that control muscle contraction. When a muscle is tired, especially when it is working in a shortened position, the signals that "excite" the muscle can outweigh the signals that tell it to relax. The result is a sustained contraction.
This explains several things athletes notice: cramps often appear late in a race or a hard session, when you go faster or harder than usual, or when a muscle is working in a position it is not used to.
2. Fluid and electrolyte losses
The older and more popular theory focuses on sweat. During long or hot sessions you lose water and electrolytes, mainly sodium. Some athletes, particularly "salty sweaters", seem more prone to cramping in long events. The evidence here is mixed: many athletes who cramp are not dehydrated, and many dehydrated athletes don't cramp.
In practice, cramps probably have more than one cause, and the triggers can differ between people.
Common risk factors
- Training harder, longer or faster than you are used to
- Poor conditioning for the specific event or movement
- A history of cramping
- Long sessions in heat, or heavy sweating
- Poor sleep and accumulated fatigue
- Not eating or drinking enough before long sessions
Magnesium, potassium and cramps: what the evidence says
Magnesium and potassium both play a role in how muscles work. In Great Britain the authorised claims are that magnesium contributes to normal muscle function and to electrolyte balance, and potassium contributes to normal muscle function.
That does not mean they prevent cramps. Research on magnesium supplements for typical muscle cramps, much of it in older adults with night cramps, has generally found that magnesium is unlikely to make a meaningful difference for most people. Evidence for exercise-associated cramps is limited.
So the sensible view is this: make sure you get enough magnesium and potassium as part of a balanced diet that supports your training, but don't expect a supplement to fix cramps on its own.
Food sources
- Magnesium: nuts and seeds, wholegrains, oats, beans and lentils, leafy greens, dark chocolate.
- Potassium: potatoes, bananas, beans and lentils, dried fruit, yoghurt, tomatoes, leafy greens.
If your diet is busy or inconsistent, a convenient drink-mix can help you cover the basics. Vitastrong Magnesium & Potassium is an orange-flavoured stick to dissolve in water, with magnesium, potassium, vitamin C and B vitamins.
Orange-flavoured sticks to dissolve in water with magnesium, potassium, vitamin C and B vitamins; magnesium and potassium contribute to normal muscle function.
View product →If you prefer a capsule with no mixing, magnesium bisglycinate is a well-tolerated form. You can compare forms in our magnesium forms guide.
Practical ways to reduce your risk
Build up gradually
Cramps often show up when you do more than your body is prepared for. Increase distance, load or intensity gradually, and include sessions that mimic what you will do on race day.
Strengthen the muscles that cramp
Calves and hamstrings that are well conditioned are less likely to fatigue early. Add calf raises, Romanian deadlifts, hamstring curls and plyometrics to your programme.
Pace yourself
Starting too fast is a classic trigger. Stick to your planned pace, especially early in long events.
Fuel and hydrate for the session
For sessions over about an hour, or in heat, plan your drinks and carbohydrates. Our winter hydration guide explains why sweat losses still matter in cold weather, and the winter marathon fuelling guide covers long runs.
Sleep and recover
Fatigue is a key factor. Prioritise sleep and rest days, especially during heavy training blocks.
What to do when a cramp hits
- Stop and stretch gently. Lengthening the cramping muscle is the quickest way to ease most cramps. For a calf cramp, straighten the leg and pull your toes towards you.
- Massage the area once the worst has passed.
- Ease back in. Resume at a lower intensity if you continue.
When to see a doctor
Most cramps are harmless. See your GP if cramps are very frequent or severe, happen without exercise, come with muscle weakness, swelling, redness or numbness, or started after beginning a new medication. Some medicines and medical conditions can contribute to cramps.
Products mentioned in this article
Orange-flavoured sticks to dissolve in water with magnesium, potassium, vitamin C and B vitamins; magnesium and potassium contribute to normal muscle function.
View product →
Vegan capsules providing 450 mg of magnesium as bisglycinate with vitamin B6; magnesium contributes to normal muscle function.
View product →FAQs
Does magnesium stop cramps?
Magnesium contributes to normal muscle function, but research has generally not found that magnesium supplements prevent typical muscle cramps for most people. Focus on training, pacing, fuelling and recovery as well.
Are cramps caused by dehydration?
Sometimes fluid and sodium losses may play a part, especially in long, hot events, but many cramps happen without dehydration. Fatigue is thought to be a major factor.
Why do I get cramps at night?
Night cramps are common, particularly with age, and often have no clear cause. If they are frequent or disrupt your sleep, talk to your GP.
Should I take an electrolyte drink for every workout?
For most gym sessions under an hour, water is enough. Electrolytes are more relevant for long sessions, heavy sweating or hot conditions.
What is the quickest way to stop a cramp?
Gently stretch the affected muscle and hold the stretch until the cramp eases, then massage the area.
Food supplements should not be used as a substitute for a varied, balanced diet and a healthy lifestyle.