Muscle Cramps and Spasms: Causes and What Helps

A cramp is a sudden involuntary contraction of a muscle that will not release. It hurts sharply, the muscle can be felt as a hard knot, and it lasts seconds to a few minutes, frequently leaving the area tender for a day afterwards. Most people experience them and most cramps mean nothing.
The explanations usually offered for them — dehydration and low electrolytes — are considerably less well supported than their popularity suggests, and the treatments that follow from those explanations are correspondingly disappointing.
🧠 What actually stops a cramp, and why: stretching the affected muscle. Forcefully lengthening a cramping muscle activates the tendon receptors that signal excessive tension, and their reflex response inhibits the contraction. For a calf cramp that means pulling the toes toward the shin with the leg straight. It works within seconds, it works better than anything else, and it works because of a specific reflex rather than because of anything to do with fluid or salt.
⚖️ Cramp, spasm and spasticity are different things
These get used interchangeably and describe quite different problems with quite different treatments.
| What it is | Typical cause | |
|---|---|---|
| Cramp | Sudden, painful, involuntary contraction lasting seconds to minutes, with a palpable hard muscle | Usually benign; commonly nocturnal or exercise-associated |
| Muscle spasm | Sustained involuntary tightening, often protective around an injury | Acute back or neck injury, guarding |
| Spasticity | Velocity-dependent increase in muscle tone — resistance rises the faster the limb is moved | Damage to the pathways from brain to spinal cord: stroke, multiple sclerosis, spinal injury, cerebral palsy |
| Dystonia | Sustained or repetitive twisting contractions producing abnormal postures | A movement disorder, sometimes drug-induced |
| Fasciculation | Visible twitching of small parts of a muscle without movement of the joint | Usually benign; occasionally significant when accompanied by weakness |
This distinction matters commercially as well as clinically, because the drugs used for spasticity — tizanidine, baclofen — are not the drugs used for ordinary cramps or acute muscle spasm, and they are frequently offered for the wrong one. Spasticity is covered separately in the guide to muscle spasticity.
🌙 Night cramps
Cramps in the calf or foot that wake someone from sleep are extremely common, particularly over the age of fifty and in pregnancy. They can be severe enough to disturb sleep night after night, and the tenderness afterwards lasts into the following day.
The honest position on cause is that it is not well established. Proposed contributors include shortening of the calf muscles from sleeping with the feet pointed downward, age-related changes in nerve supply to muscle, reduced daytime activity, and alterations in the reflex control of muscle contraction.
What is reasonably clear is what does not explain most of them, which brings us to the main correction in this article.
💧 The dehydration and electrolyte question
The standard explanation is that cramps result from dehydration and depletion of sodium, potassium, calcium or magnesium. It is intuitive, it is repeated everywhere, and the evidence supporting it is weaker than almost anyone assumes.
Studies of athletes prone to exercise-associated cramps compared them with athletes who never cramp under the same conditions and found no consistent difference in hydration status or in blood electrolyte concentrations. Cramps occur in well-hydrated people and fail to occur in dehydrated ones.
The prevailing alternative explanation is altered neuromuscular control: as a muscle fatigues, the excitatory signal from muscle spindles increases while the inhibitory signal from tendon receptors decreases, and the resulting imbalance allows sustained involuntary firing. That model explains why cramps occur in the muscle being worked hardest, why they occur near the end of exertion, why they are commoner in those doing something unaccustomed, and above all why stretching — which restores the inhibitory signal — stops them immediately.
Two qualifications keep this accurate. Genuine, measured electrolyte abnormalities do cause cramps, and they occur in specific situations: dialysis, severe vomiting or diarrhoea, diuretic use, alcohol misuse and certain endocrine disorders. And in extreme prolonged exertion in heat, substantial sodium loss does appear to contribute for some people. What does not hold up is the general assumption that an ordinary cramp in an ordinary person indicates a deficiency requiring supplementation.
⚠️ On magnesium specifically: reviews of the trials find it no better than placebo for cramps in older adults, which is the group that buys the most of it for exactly this purpose. There is some suggestion of benefit in pregnancy-related cramps, where the evidence is more mixed. Correcting a measured deficiency is a different matter and is worth doing. Taking magnesium routinely for night cramps, in the absence of a deficiency, is buying an expensive placebo.
💊 Medications that cause cramps
This is worth checking before anything else, because it is common, frequently unrecognised, and often fixable.
| Drug group | Note |
|---|---|
| Diuretics | Through fluid and electrolyte loss; among the commonest culprits |
| Statins | Muscle symptoms including cramps and aching; distinguishing genuine statin muscle effects from coincidental symptoms requires a structured approach rather than simply stopping |
| Beta agonists such as salbutamol | Particularly at higher doses |
| Some antihypertensives | Including certain calcium channel blockers |
| Oral contraceptives and hormone therapy | Reported in some users |
| Some antipsychotics and antiemetics | Can cause dystonic reactions rather than true cramps, which look different and are treated differently |
| Alcohol | Both directly and through nutritional and electrolyte effects |
The useful clue is timing: cramps beginning within weeks of starting or increasing a medication are worth attributing to it until shown otherwise. Nothing should be stopped independently, and raising it with the prescriber frequently produces a switch that resolves the problem.
🔴 Quinine
This needs stating clearly because it was standard practice for decades and is still requested.
Quinine was widely used for night cramps and does reduce their frequency modestly. It has been restricted or withdrawn for this indication in numerous countries, and regulators including the FDA have specifically warned against its use for leg cramps.
The reason is that it causes serious blood disorders in a small number of people — most importantly a severe fall in platelets, which can produce life-threatening bleeding — along with irregular heart rhythms and severe hypersensitivity reactions. These are unpredictable, can occur after years of uneventful use, and have caused deaths.
Set against a modest reduction in a benign symptom, that trade is not acceptable. Tonic water contains far too little quinine to have any therapeutic effect, so it is neither useful nor a risk.
🔍 When cramps mean something else
Most cramps are benign. A few patterns are not, and they are distinguished mainly by what accompanies them.
| Pattern | Consider |
|---|---|
| Calf pain reliably brought on by walking a predictable distance and relieved by standing still | Peripheral arterial disease. This is claudication, not cramp, and it indicates arterial narrowing that carries cardiovascular risk elsewhere |
| An urge to move the legs, worse at rest and in the evening, relieved by movement, more uncomfortable than painful | Restless legs syndrome — a different condition with different treatment |
| Cramps with progressive weakness, visible twitching and muscle wasting | Requires neurological assessment; motor neuron disease presents this way |
| Widespread muscle pain and weakness, dark urine | Muscle breakdown; needs urgent assessment |
| Cramps with numbness, tingling or burning in a stocking distribution | Peripheral neuropathy, most often diabetic |
| Cramps with cold intolerance, weight gain, fatigue, dry skin | Underactive thyroid |
| Cramps in someone on dialysis or with liver cirrhosis | Common in both, with specific management |
| Cramps in the hands and around the mouth, with tingling | Low calcium; also occurs with hyperventilation |
The claudication distinction is the most clinically important of these. Cramp occurs at rest or randomly; claudication is reproducible, appears at a consistent walking distance, and stops within a couple of minutes of standing still. Someone describing that pattern has narrowed arteries, which matters far beyond the leg.
🏃 Exercise-associated cramps
These occur toward the end of prolonged or intense exertion, in the muscle being worked hardest, and typically in people doing more than they are conditioned for.
What reduces them, following from the neuromuscular explanation:
- Building up gradually rather than making large jumps in duration or intensity
- Not exceeding your trained pace in an event, which is when cramps predictably appear
- Regular stretching of the muscles that cramp, which has modest but real evidence
- Adequate conditioning of the specific muscle groups involved
- Reasonable hydration and salt intake in prolonged exertion in heat, where the extreme end of the spectrum does appear to matter
The often-recommended pickle juice is not folklore — small studies found it shortened cramp duration, and too quickly for absorption to explain it, suggesting a reflex triggered by the strong taste in the mouth and throat. The evidence is limited, and it is harmless to try.
🛏️ Managing night cramps
During a cramp: stretch the muscle. For the calf, straighten the leg and pull the toes toward the shin, or stand and lean forward against a wall with the heel down. Massage and heat afterwards ease the residual soreness.
To reduce frequency:
- Stretch the calves before bed — the evidence is modest but it is free and harmless
- Keep bedding loose at the foot end, so the feet are not held pointing downward all night
- Stay reasonably active during the day
- Review medications, particularly diuretics
- Check for the secondary causes above where the pattern is new, severe or atypical
- Moderate alcohol
Tilting the foot of the bed slightly upward, and avoiding a heavy tucked-in top sheet, both address the same mechanism and are worth trying because they cost nothing.
💥 Acute back and neck spasm
This is a different problem from cramp and is the one for which muscle relaxants have a genuine role.
After a sudden strain, the surrounding muscles contract protectively and stay contracted. The result is severe pain and restricted movement, and the muscle spasm becomes a source of pain in its own right, separate from whatever caused it.
What helps:
Keeping moving within the limits of pain. Rest prolongs recovery, and this is well established. Movement is uncomfortable and is what resolves it.
Anti-inflammatory painkillers at an adequate dose for a short period, taken regularly rather than occasionally.
Heat, which relaxes the muscle and eases pain.
A muscle relaxant for a short course. Methocarbamol is a centrally acting agent used specifically for acute painful musculoskeletal spasm, and this is its indication rather than an off-label application. It provides modest additional benefit alongside anti-inflammatories in the acute phase.
Three points about muscle relaxants generally. They are for days rather than weeks, since benefit does not persist and sedation and dependence considerations accumulate. They cause drowsiness, so driving and machinery need care. And they are not the treatment for spasticity, for ordinary night cramps, or for chronic back pain — their place is the acute painful spasm of a recent musculoskeletal injury.
The broader management of back pain, including why early scanning is unhelpful, is covered in the guide to back pain.
🤰 Cramps in pregnancy
Leg cramps are common in pregnancy, particularly in the later months and at night, and they are one of the more consistently under-discussed discomforts of it.
Stretching, keeping bedding loose and staying moderately active all apply as above. Magnesium has more supporting evidence here than in the general population, though it remains mixed, and it is one of the few situations where a trial of it is reasonable.
Anything unusual warrants attention rather than being attributed to pregnancy. Calf pain that is one-sided, constant rather than episodic, with swelling, warmth or redness, is not a cramp — it needs same-day assessment, because the risk of deep vein thrombosis is raised in pregnancy and the presentation is easily dismissed.
🧪 What to check
For cramps that are frequent, severe, new or accompanied by anything else, a reasonable set of tests covers:
- Kidney function and electrolytes including sodium, potassium, calcium and magnesium
- Thyroid function
- Glucose or HbA1c, given diabetic neuropathy
- Vitamin D
- Full blood count and ferritin, particularly where restless legs is suspected, since low iron stores drive it and the target is higher than the usual normal range
- Creatine kinase where there is muscle pain or weakness
- Liver function
- A medication review, which is free and frequently the most productive item on the list
✅ A sensible order of approach for ordinary night cramps: stretch during the attack, stretch before bed, keep bedding loose at the feet, stay active during the day, and review your medications with particular attention to diuretics. If the cramps are new, severe, one-sided, accompanied by weakness or twitching, or brought on reliably by walking, that changes the picture and warrants assessment rather than another supplement.
🚨 When to seek help
- Calf pain reliably triggered by walking a set distance and relieved by rest — suggests arterial disease
- One-sided calf pain with swelling, warmth or redness — possible clot, same-day assessment
- Cramps with progressive weakness, wasting or persistent twitching
- Dark urine with muscle pain — urgent
- Cramps affecting the hands, face or trunk rather than the legs
- Cramps disturbing sleep most nights despite the measures above
- New cramps after starting a medication
- Cramps with numbness, tingling or burning suggesting nerve involvement
Treatment for acute painful muscle spasm is stocked in the muscle relaxer category, including Robaxin (methocarbamol), which is indicated for exactly that situation and used for a short course alongside anti-inflammatories. It is not a treatment for ordinary night cramps, for which stretching and the measures above are what work.
❓ Frequently asked questions
What stops a cramp fastest?
Stretching the affected muscle. For a calf cramp, straighten the leg and pull the toes toward the shin, or stand and lean forward against a wall with the heel down. It works within seconds because forcefully lengthening the muscle activates tendon receptors that signal excessive tension, and their reflex response inhibits the contraction. Massage and heat afterwards ease the residual soreness.
Are cramps caused by dehydration?
Less often than assumed. Studies comparing athletes prone to cramps with those who never cramp under the same conditions found no consistent difference in hydration or blood electrolytes. Cramps occur in well-hydrated people and fail to occur in dehydrated ones. The prevailing explanation is altered neuromuscular control as a muscle fatigues, which also explains why stretching stops them immediately.
Does magnesium help with leg cramps?
Reviews of the trials find it no better than placebo for cramps in older adults, which is the group that buys the most of it for this purpose. There is some suggestion of benefit in pregnancy-related cramps, where evidence is more mixed. Correcting a measured deficiency is a different matter and worth doing. Taking it routinely without a deficiency is buying an expensive placebo.
Why is quinine no longer prescribed for cramps?
Because it causes serious blood disorders in a small number of people, most importantly a severe fall in platelets that can produce life-threatening bleeding, along with irregular heart rhythms and severe hypersensitivity reactions. These are unpredictable, can occur after years of uneventful use, and have caused deaths. Against a modest reduction in a benign symptom, that trade is not acceptable. Tonic water contains far too little to matter either way.
Could my medication be causing them?
Quite possibly, and it is worth checking before anything else. Diuretics are among the commonest culprits. Statins cause muscle symptoms including cramps, and beta agonists such as salbutamol, some blood pressure drugs, hormonal contraception and alcohol all contribute. The clue is timing — cramps beginning within weeks of starting or increasing something are worth attributing to it until shown otherwise.
My calf hurts when I walk. Is that a cramp?
Probably not, and this distinction matters. Pain reliably brought on by walking a predictable distance and relieved within a couple of minutes of standing still is claudication, caused by narrowed arteries rather than by muscle contraction. It needs assessment, because arterial narrowing in the leg indicates the same process affecting arteries elsewhere. Cramp occurs at rest or randomly and is not reproducible by distance.
How do I tell cramps from restless legs?
Restless legs produces an urge to move rather than pain, is worse at rest and in the evening, and is relieved by moving — which is the opposite of a cramp, where movement of the contracted muscle is agonising until it is stretched. Restless legs is a distinct condition with different treatment, and checking iron stores is central to it, since low ferritin drives it and the target is higher than the usual normal range.
Do muscle relaxants help night cramps?
Not really, and they are frequently offered for it. Their genuine indication is acute painful musculoskeletal spasm after a strain, where a short course alongside anti-inflammatories provides modest benefit. Tizanidine and baclofen specifically are for spasticity from nervous system damage, which is a different problem again. For ordinary night cramps, stretching and the practical measures work better than any tablet.
How can I prevent cramps during exercise?
Build up gradually rather than making large jumps in duration or intensity, do not exceed your trained pace in an event, stretch the muscles that cramp regularly, and condition the specific muscle groups involved. Cramps appear in the muscle worked hardest, near the end of exertion, in people doing more than they are conditioned for — which follows directly from the fatigue explanation rather than the electrolyte one.
What can I do about cramps in pregnancy?
Stretching, keeping bedding loose at the foot end and staying moderately active. Magnesium has more supporting evidence here than in the general population, though it is still mixed, and a trial of it is reasonable. Importantly, one-sided calf pain that is constant rather than episodic, with swelling, warmth or redness, is not a cramp and needs same-day assessment, since clot risk is raised in pregnancy.
Which cramps should be investigated?
Cramps with progressive weakness, muscle wasting or persistent twitching. Cramps with dark urine and muscle pain, which is urgent. Cramps affecting the hands, face or trunk rather than the legs. Cramps with numbness, tingling or burning suggesting nerve involvement. New cramps after starting a medication. And cramps disturbing sleep most nights despite stretching and the practical measures.
What is the difference between a cramp and spasticity?
A cramp is a sudden painful contraction lasting seconds to minutes with a palpably hard muscle, usually benign. Spasticity is a sustained increase in muscle tone that rises the faster a limb is moved, caused by damage to the pathways from brain to spinal cord in conditions such as stroke, multiple sclerosis, spinal injury or cerebral palsy. They are different problems requiring entirely different medication.
📑 Sources and editorial
- Schwellnus MP and colleagues — altered neuromuscular control as the mechanism of exercise-associated muscle cramping
- Cochrane review of magnesium for skeletal muscle cramps
- FDA and other regulatory advisories against off-label quinine use for leg cramps
- Evidence reviews on stretching for the prevention of nocturnal leg cramps
- Literature on medication-associated muscle cramps, particularly diuretics and statins
- Guidance distinguishing intermittent claudication from muscle cramp
- FDA prescribing information for methocarbamol
- Related reading: muscle spasticity, back pain
- Related products: muscle relaxer category
- RXshop Editorial Team — reviewed by Emily Chen, MD, MPH, Internal Medicine
Medical Disclaimer: The information in this article is for educational and informational purposes only and is not a substitute for professional medical advice, diagnosis, or treatment. Always seek guidance from a qualified healthcare provider with any questions you may have regarding a medical condition, and before starting, stopping or changing any medication.