Requests

Laboratory tests

Leg cramps: causes

A cramp is a sudden, involuntary and painful muscle contraction. The muscle becomes hard and 'knotted' for seconds or minutes.

Clínica Alegre practitioner examining a blood sample tube beside sample collection tubes

Reviewed by Dr Fernando Alegre

Clinical Director · OMD, registration no. 9688

Written by the Clínica Alegre team9-minute read

In this article

In the legs, cramps mainly affect the calf muscles, but also the sole of the foot and the thigh. When they occur during sleep or at rest, they are known as night cramps (nocturnal leg cramps). They are very common, become more frequent with age and can seriously disrupt sleep.

This article explains why cramps occur, the factors and conditions associated with them, how to distinguish them from other leg problems and the true role of laboratory tests, which is more limited than many people think. Test results should not be interpreted in isolation: the doctor who ordered them should read them alongside the patient's medical history. Reference values vary between laboratories and methods.

What happens in a muscle during a cramp

A cramp is caused by abnormal firing of the nerves that control the muscle. Instead of a controlled contraction, the fibres fire repeatedly and the muscle cannot relax. The most widely accepted theory is that cramps originate mainly in the peripheral nerve and spinal cord rather than the muscle itself. This explains why stretching the muscle, which stimulates tension receptors, usually stops the cramp.

Muscle fatigue appears to play an important role: a tired muscle is less able to suppress this firing. During sleep, pointed toes (with the foot extended), encouraged by the weight of the bedclothes, keep the calf muscles shortened. This helps explain why night cramps so often affect the calf.

FeatureTypical cramp
OnsetSudden, often at rest or during sleep
LocationCalf, sole of the foot, sometimes thigh
DurationSeconds to a few minutes
MuscleHard and visibly contracted
ReliefStretching the muscle
AfterwardsResidual pain that may last for hours

Cramps with no identifiable cause: the most common type

A review published in a family medicine journal in 2012 reports that up to about 60% of adults say they have experienced night leg cramps and that, for most people, no specific cause is found. These are known as idiopathic cramps. They are more common from the age of 50, possibly because of loss of muscle mass, shortening of the tendons and reduced physical activity.

Having idiopathic cramps does not mean that you have a hidden illness. It means the risk factors are mainly part of daily life and that the principal measures involve stretching, regular physical activity and reviewing habits and medicines.

Everyday factors that encourage cramps

Intense or unfamiliar exercise, particularly in hot weather, is a known cause of exercise-associated cramps. Spending many hours sitting, standing still or with your legs crossed also encourages muscles to shorten. Many people notice more cramps after particularly active days or when wearing unsuitable footwear.

Dehydration and salt loss, such as during episodes of vomiting or diarrhoea or through heavy sweating, can trigger cramps. However, the role of water and salt intake alone in everyday cramps is less clear than is often claimed, and the scientific evidence is conflicting.

FactorLikely mechanismNote
Intense or unfamiliar exertionMuscle fatigueMore common in athletes and people who change their activity
Inactivity, many hours spent sittingShortened musclesCommon in older people
Pointed position of the feet in bedShortening of the calf musclesContributes to night cramps
Dehydration, vomiting, diarrhoeaChanges in fluid and salt levelsMixed evidence for ordinary cramps
HeatSweating and salt lossMainly associated with exertion

Pregnancy

Leg cramps are very common in pregnancy, especially during the second and third trimesters and at night. Suggested causes include changes in circulation, additional weight, changes in mineral metabolism and compression of nerves and blood vessels. For most pregnant women, cramps are uncomfortable but not dangerous and disappear after the birth.

Even so, a swollen, hot, red and painful leg during pregnancy should not be mistaken for cramp: pregnancy increases the risk of venous thrombosis, which requires a medical assessment that day. Any supplement taken during pregnancy, including magnesium or calcium, should be discussed with the doctor providing your care.

Conditions associated with cramps

Some conditions increase the frequency of cramps. The same 2012 review mentions peripheral vascular disease, lumbar spinal stenosis, cirrhosis, haemodialysis and pregnancy, among others. Diabetes, particularly when there is nerve damage (neuropathy), chronic kidney disease and hypothyroidism are also frequently mentioned.

Cramping can occur in amyotrophic lateral sclerosis and in other disorders affecting nerves outside the brain and spinal cord. It does not usually occur alone in these conditions. Other warning signs tend to include weakness, shrinking muscles or tiny movements that can be seen under the skin. If weakness develops alongside new cramps, seek a medical assessment.

Condition or situationClues that may accompany the cramps
Peripheral arterial diseasePain when walking that improves with rest
Lumbar spinal stenosisLower back pain, leg pain when walking and standing
CirrhosisKnown liver disease, alcohol consumption
Chronic kidney disease, haemodialysisKnown kidney disease
Diabetes with neuropathyTingling, numbness in the feet
HypothyroidismTiredness, feeling cold, dry skin, constipation
Neuromuscular diseasesLoss of strength, muscle wasting, fasciculations

Medicines that may be involved

Several medicines have been associated with the onset of cramps. A 2012 study based on prescription data from a Canadian province found an association between starting some diuretics or long-acting inhaled bronchodilators (used for asthma and COPD) and the subsequent prescription of treatments for cramps; the association was weaker for statins. These data show an association and do not prove that the medicine causes cramps in any individual.

If you suspect that your cramps began after starting a new medicine, speak to the doctor who prescribed it. Never stop taking a prescription medicine on your own initiative: many of these medicines protect the heart, kidneys or lungs, and the doctor may adjust the dose or switch to another option.

The role of laboratory tests

Contrary to what many people expect, routine tests are not recommended for everyone with cramps. The 2012 review states that, for typical night cramps, the medical history and physical examination are usually enough and routine tests such as electrolyte tests are unnecessary. Tests become useful when the history or examination suggests a specific cause.

In these cases, depending on the circumstances, the doctor may request an electrolyte panel (sodium and potassium), calcium, magnesium, glucose, kidney function, liver function, TSH or CK (creatine kinase, an enzyme that rises when muscles are damaged). Ranges vary between laboratories and should be read on the report. A value just outside the range may not explain the cramps, and the doctor is responsible for interpreting it.

TestWhat it can help assess
Potassium and sodiumSalt imbalances, for example due to diuretics or vomiting
Calcium and magnesiumMineral imbalances, for example due to certain medicines or conditions
Glucose, HbA1cDiabetes
CreatinineKidney function
TSHThyroid function
CKMuscle damage, for example associated with statins

Cramps or something else?

Several leg problems can be mistaken for cramps. Restless legs syndrome causes an irresistible urge to move the legs, without a hard muscle contraction, and improves with movement. Claudication, which is typical of arterial disease, is pain when walking that forces you to stop. Neuropathy causes tingling, burning and numbness. Widespread muscle pain associated with medicines or muscle diseases does not have the sudden, localised nature of a cramp.

This distinction matters because the causes, tests and treatments are different. Describing the symptoms clearly to your doctor — when they occur, how long they last, whether the muscle hardens and what relieves them — is a great help in making a diagnosis.

How to prepare for the appointment

Before your appointment, it may help to record when the cramps occur, how long they last, which muscle is affected, what relieves them and what you did that day, over a period of two or three weeks. Also bring a complete list of medicines and supplements, including those bought without a prescription, and any previous test results you have.

Information to bringWhy it helps
Cramp diaryShows frequency, timing and possible triggers
List of medicines and start datesHelps link cramps to new medicines
Known conditionsPoints to kidney, liver, vascular or neurological causes
Previous test resultsAvoids repetition and allows comparison

Warning signs

Most cramps are harmless, but some signs warrant prompt assessment. A swollen, hot, red and painful leg, particularly on one side only, may indicate venous thrombosis and requires assessment that day. Severe and widespread muscle pain with weakness and dark urine, particularly in someone taking statins or who has undertaken extreme exertion, may indicate serious muscle damage.

Cramps accompanied by progressive weakness, loss of muscle mass, altered sensation or difficulty speaking or swallowing warrant a prompt medical appointment. If there is sudden shortness of breath, chest pain, severe palpitations or fainting, call 112.

At Clínica Alegre in Setúbal and Seixal, you can have laboratory tests and ask our team any questions about the results.

Frequently asked questions

Are cramps always caused by a lack of magnesium?

No. Most people are not found to have a deficiency, and studies of magnesium for ordinary cramps show little or no benefit.

Do I need tests because I have cramps?

Not always. Your doctor will decide based on your medical history and examination; tests are useful when a specific cause is suspected.

Can cramps be a sign of circulation problems?

They can be associated with vascular disease, but pain caused by poor arterial circulation occurs mainly when walking and improves when you stop.

Why do I get more cramps at night?

Rest, the pointed position of the feet and fatigue accumulated during the day are likely explanations.

Does drinking more water prevent cramps?

It may help if you are dehydrated, but the evidence for ordinary cramps is limited.

Do cramps become more common with age?

Yes, they become more common from the age of 50.

Did you enjoy this article?

Scientific references3
  1. Allen RE, Kirby KA. Nocturnal leg cramps. Am Fam Physician. 2012;86(4):350–5.
  2. Garrison SR, Dormuth CR, Morrow RL, et al. Night-time leg cramps and the prescription use preceding them: a sequence symmetry analysis. Arch Intern Med. 2012;172(2):120-6.
  3. Garrison SR, Korownyk CS, Kolber MR, et al. Magnesium for skeletal muscle cramps. Cochrane Database Syst Rev. 2020; 9(9):CD009402.
Article information
Written by
Clínica Alegre team
Clinical review
Dr Fernando Alegre, Clinical Director · OMD, registration no. 9688
Published
2 Dec 2026
Last updated
2 Dec 2026
Topic
Laboratory tests
Reading time
9 min

See also

Related treatments

Want to know what is right for you?

Contact us on WhatsApp or book an assessment, in person or online.

Book an appointment

Book your assessment.

Choose Setúbal or Seixal. We reply within opening hours.

Newsletter

Get the latest news from the Clínica Alegre.

Blog articles and clinic news, delivered to your inbox. Unsubscribe at any time.