It is 2 a.m. Your calf suddenly seizes into a hard, painful knot, and you leap out of bed to stretch it out. By morning the muscle is still tender, and you are left wondering what just happened. Night leg cramps — sometimes called nocturnal leg cramps or a “charley horse” — are one of the most common reasons people wake in pain, affecting up to 60% of adults at some point and becoming more frequent with age.
Most of the time these cramps are harmless. But a cramp is essentially a misfired signal from your nerves and muscles, so a pattern of frequent or severe night cramps can occasionally point to something fixable — a mineral imbalance, dehydration, or a thyroid or blood-sugar problem — or, less often, a warning sign worth investigating. The good news is that a short list of lab tests can usually tell the two apart.
Start here: not all night leg cramps are the same
Before you order tests, it helps to know what you are actually feeling. A true nocturnal leg cramp is a sudden, visible, painful contraction — usually in the calf or foot — that you can often relieve by forcefully stretching the muscle. That is different from three conditions people frequently confuse it with:
- Restless legs syndrome (RLS): an uncomfortable urge to move the legs, not a painful contraction. It eases with movement rather than stretching.
- Periodic limb movements of sleep: repetitive jerks you may not fully wake for.
- Claudication: cramping leg pain brought on by walking and relieved by rest — a possible sign of poor circulation, discussed below.
According to StatPearls, most nocturnal cramps are idiopathic (no single cause is found), but they can be triggered by dehydration, electrolyte imbalances, medications, overexertion, pregnancy, and specific medical conditions. That is why a targeted panel — rather than a scattershot of every test available — is the smart approach when cramps are frequent, severe, or new for you.
Magnesium and mineral balance
Muscles need a precise balance of minerals to contract and then let go. Magnesium is central to that “relaxation” step, which is why it gets the most attention. You can check magnesium with a simple blood draw, but there is an important catch: serum magnesium reflects only about 1% of your body’s total, and the NIH Office of Dietary Supplements notes that a normal blood level does not rule out a whole-body deficit. Your body pulls magnesium from bone and muscle to keep the blood number steady.
Be realistic about what correcting magnesium can do: large reviews have found that supplements do not reliably prevent cramps in the general adult population, though a trial may still help selected people (and there is somewhat better evidence in pregnancy). Low magnesium is also frequently tangled up with other deficiencies — the same picture we describe for chronic fatigue.
Two other minerals belong in the same conversation, and both appear on a routine basic metabolic panel: potassium and calcium. Low potassium (from diuretics, vomiting, or diarrhea) and low calcium (sometimes tied to low vitamin D or a parathyroid problem) can each make muscles hyper-excitable and prone to cramping. These do not yet have dedicated reference pages on Wizey, but your lab report lists them alongside sodium.
Dehydration and electrolyte shifts
Fluid and salt travel together. When you sweat heavily, drink a lot of alcohol, or take a diuretic (“water pill”) for blood pressure, you lose both water and electrolytes — and the resulting shifts in sodium and potassium are a classic cramp trigger, especially in hot weather or after exercise.
The counter-intuitive part: the fix is not simply “drink more water.” Overhydrating with plain water dilutes your blood sodium, a state called hyponatremia that can also cause cramps and, in extreme cases, becomes dangerous — as in this water-intoxication case. The lesson is balance. A basic metabolic panel, which measures sodium, potassium, chloride, and bicarbonate, is the single most useful test here.
Kidney function
Your kidneys are the master regulators of water and electrolytes, so when they underperform, cramps often follow. Nocturnal cramps are especially common in people with chronic kidney disease and in those on dialysis, driven by rapid fluid and mineral shifts. Two markers estimate how well the kidneys are filtering: creatinine and urea (BUN). A rising creatinine (and the eGFR calculated from it) is the standard signal that kidney function is dropping, while urea adds context about hydration and protein turnover. If your cramps come with swelling, foamy urine, or high blood pressure, these two numbers are a priority.
Thyroid
An underactive thyroid (hypothyroidism) slows the whole body’s metabolism, and muscle symptoms — cramps, aching, stiffness, and slow-to-relax reflexes — are a well-recognized part of the picture. The screening test is TSH: when the thyroid is sluggish, the pituitary raises TSH to prod it. A high TSH with symptoms usually prompts a free-T4 check to confirm. If your night cramps arrive alongside fatigue, cold intolerance, weight gain, or dry skin, thyroid testing is worthwhile — our guide to reading a TSH result walks through the numbers.
Blood sugar and nerves
Persistently high blood sugar damages both nerves and the small vessels that feed them. The result, diabetic neuropathy, can produce cramping, burning, and tingling in the feet and calves that is characteristically worse at night. The NIDDK estimates that up to half of people with diabetes develop peripheral neuropathy over time. A fasting glucose — usually paired with HbA1c, which reflects your average over three months — screens for diabetes and prediabetes. Cramps are rarely the first clue to diabetes, but in someone with risk factors or numbness, blood-sugar testing earns its place.
Red flags — see a doctor now
Most night cramps are a nuisance, not an emergency. But some patterns deserve prompt medical attention rather than another magnesium tablet:
- Leg pain when you walk that eases with rest (claudication). This can signal peripheral artery disease, narrowed leg arteries that also raise the risk of heart attack and stroke. It warrants a vascular exam and an ankle-brachial index.
- Numbness, tingling, burning, or weakness in the legs or feet — possible nerve involvement (neuropathy).
- One leg suddenly swollen, red, warm, and painful. This is not a simple cramp and may be a blood clot (deep vein thrombosis) — seek same-day care.
- Cramps plus dark, cola-colored urine after intense exertion, which can indicate muscle breakdown (rhabdomyolysis).
- Very frequent or worsening cramps, or cramps in someone with known kidney, thyroid, or liver disease.
What to do — and which tests to ask for
For occasional cramps, self-care goes a long way. The Cleveland Clinic recommends stretching the calf and hamstring before bed, staying evenly hydrated, gently flexing the foot upward during an attack, and applying heat or massage. Review your medication list with your doctor, too — diuretics, statins, and some blood-pressure and asthma drugs are linked to cramps, but you should never stop a prescription on your own. (Older remedies like quinine are no longer recommended because the risks outweigh the benefit.)
When cramps are frequent or persistent, bring this shortlist to your appointment:
- Basic metabolic panel — sodium, potassium, calcium, creatinine, urea, and glucose in one draw.
- Magnesium — with the caveat that a normal result does not fully exclude a deficit.
- TSH — to screen the thyroid.
- HbA1c and vitamin D — if you have risk factors or other symptoms.
Once results are back, the goal is to read them together rather than one line at a time — a slightly high TSH, a low-normal potassium, and a borderline glucose can add up to a story that no single value tells. You can browse more explainers in our lab analyses and health sections to see how these pieces connect.
Frequently asked questions
Can low magnesium cause night leg cramps? Low magnesium is one possible contributor, but the link is weaker than supplement ads suggest. A standard serum magnesium test can look normal even when tissue stores are low, and large reviews have not shown that magnesium reliably prevents cramps in most adults. It is still reasonable to check magnesium and correct a true deficiency through diet or, if your doctor advises, supplements.
Which blood tests should I ask for if I get frequent night leg cramps? A sensible starting panel is a basic metabolic panel — sodium, potassium, calcium, glucose, and kidney markers like creatinine and urea (BUN) — plus magnesium and TSH for thyroid function. Your doctor may add HbA1c, vitamin D, or circulation tests depending on your symptoms and history.
Can dehydration cause leg cramps at night? Yes. Losing fluid and electrolytes through heavy sweating, alcohol, or diuretic (water) pills is a common trigger, especially in warm weather or after exercise. Confusingly, drinking too much plain water can also cause cramps by diluting your blood sodium, so balance — not just volume — matters.
Are night leg cramps a sign of diabetes? They can be. Poorly controlled blood sugar can damage the nerves in the legs (diabetic neuropathy), producing cramping, burning, and tingling that is often worse at night. If cramps come with numbness, or you have other diabetes risk factors, ask for a fasting glucose and HbA1c.
When should I see a doctor about leg cramps? See a doctor if cramps are frequent, severe, or new for you; if they come with numbness, weakness, or leg pain when walking that eases with rest; or if one leg is swollen, red, and warm. These can point to nerve, circulation, or clotting problems that need prompt evaluation.
Can medications cause night leg cramps? Some can. Diuretics, certain blood-pressure and asthma medicines, and statins are among the drugs linked to muscle cramps. Never stop a prescribed medication on your own — review the timing and your symptoms with your doctor, who can adjust the dose or look for another cause. Quinine is no longer recommended for cramps because of serious side effects.



