Leg cramps

Leg cramps are common and usually fleeting and harmless. They can affect any part of your leg, including your feet and thighs, but calf cramps are the most common. Leg cramps while you’re sleeping at night account for three out of every four cases. However, leg cramps can occur at any time, usually when you’re resting. 

After a leg cramp has passed, your leg may feel tender, sore or painful for a few hours. 

In most cases, the cause of leg cramps is unclear, although certain medications and diseases can cause leg cramps. You can reduce your risk of leg cramps by performing regular exercises to stretch your leg muscles. If you regularly have leg cramps and all other treatment approaches are unsuccessful, you may be prescribed quinine tablets. 

What are leg cramps?

Leg cramps occur when a leg muscle spasms ie suddenly contracts too strongly. This causes muscle pain and can make your toes and feet stiffen and consequently make it difficult to move your leg. Leg cramps can last from several seconds to 10 minutes.

Calf muscle cramps are the most common type of leg cramps — they affect the muscle below your knee that runs along the back of your lower leg. However, thigh cramps and cramps in your feet can also occur. Thigh cramps usually last the longest.

Once your leg cramps have passed, you will be able to move your leg and control the affected muscle again. However, your muscle may feel tender, sore and painful for up to 24 hours, particularly if you have severe leg cramps.

What causes leg cramps?

What causes calf cramps or leg cramps varies but your risk increases with age. Straining your muscles during exercise, especially in hot humid weather, can cause leg cramps, as can drinking too much alcohol.

Certain health conditions can also cause leg cramps — these are called secondary leg cramps. In some cases, no cause can be identified — these are called idiopathic leg cramps.

Idiopathic leg cramps

The exact cause of idiopathic leg cramps is unknown, hence the name. However, there are several theories as to what causes them, including: 

  • Abnormal nerve activity in your legs while you are sleeping
  • Contraction of an already shortened muscle — most people sleep with their knees slightly bent and their feet pointing downwards, which shortens the calf muscle; if the calf muscle then contracts further it may spasm; consequently stretching exercises may reduce the likelihood of leg cramps while sleeping
  • Putting too much strain on your leg muscles eg when exercising
  • Tendons that are too short — tendons (tough bands that connect muscles with bones) naturally shorten with age; if tendons become too short, the muscles they’re connected to may cramp

Other risk factors for idiopathic leg cramps include:

  • An inactive lifestyle — sitting for long periods of time puts your muscles in a flexed (shortened) position, which makes them more likely to cramp; an active lifestyle helps stretch your muscles out so they can function properly
  • Poor sitting posture — crossing your legs or pointing your toes for long periods of time shortens your calf muscles, which makes them more likely to cramp; try to sit with your back straight and the soles of both of your feet touching the floor
  • Standing for long periods of time — this increases your risk of leg cramps at night

Secondary leg cramps

Secondary leg cramps are caused by another health condition or underlying issue. This includes lifestyle factors, such as: 

  • Dehydration, which lowers your salt levels
  • Drinking too much alcohol — this causes dehydration but also a build-up of lactic acid, which can trigger muscle cramps
  • Exercise that strains your muscles — leg cramps may occur after you finish exercising 

Health conditions that can trigger secondary leg cramps include: 

  • Any condition that causes high or low sodium or potassium levels
  • Blood poisoning — the accumulation of toxins, such as lead or mercury, in your blood
  • Certain bacterial infections eg tetanus
  • Neurological diseases — this includes: 
    • Conditions affecting your nerves eg motor neurone disease or peripheral neuropathy
    • Degenerative brain conditions eg Parkinson’s disease
  • Liver or thyroid disease — liver disease can cause toxins to accumulate in your blood, which triggers muscle spasms; an untreated, underactive thyroid can also trigger muscle spasms
  • Peripheral arterial disease — narrowing of arteries in your leg that causes poor circulation

Other health conditions that can cause secondary leg cramps include:

  • Metabolic disorders ie disorders that affect your body’s metabolism eg diabetes
  • Structural problems caused by the position of your bones eg flat feet or spinal stenosis
  • Varicose veins — enlarged, twisted veins that prevent proper blood flow

If your kidneys are not working properly and you are being treated with renal dialysis (clearing waste products from your blood by passing your blood through a special machine), you are also at greater risk of leg cramps. 

Pregnant women have an increased risk too due to the extra strain placed on their leg muscles as their weight increases.

Leg cramps caused by medications

Certain medications can cause leg cramps in a small minority of people who take them. These medications include: 

  • Diuretics to remove fluid from your body — these are used to treat heart failure, high blood pressure and certain types of kidney disease 
  • Nifedipine — this is used to treat angina and Raynaud’s disease
  • Raloxifene — this is used to prevent osteoporosis in postmenopausal women
  • Statins and nicotinic acid to reduce your cholesterol levels — these are used to treat high cholesterol

If you’re concerned that your medication is causing leg cramps, speak to your doctor. They may be able to adjust your dosage or suggest alternative medications. 

Leg cramps diagnosis

Leg cramps are common and if you only have them occasionally, you don’t need to see your GP for a diagnosis.

When to worry about leg cramps

You should see your GP if: 

  • You have leg cramps and numbness or swelling in your legs
  • You have leg cramps with any other symptoms and are concerned
  • Your leg cramps are affecting your quality of life
  • Your leg cramps are waking you up at night
  • Your leg cramps last longer than 10 minutes
  • Your leg muscles are weakening or shrinking

They will perform a physical examination of your legs and ask you about your symptoms and medical history. If you have symptoms such as numbness or swelling, you may have an underlying condition that is causing your leg cramps. Your GP may, therefore, refer you for further tests (eg blood and urine tests) to rule out other conditions. 

You should call your GP urgently or call 111 if: 

  • Your leg cramps last longer than 10 minutes and don’t improve on exercise
  • Your leg cramps start after coming into contact with toxic, poisonous or infectious substances; this includes
    • A cut that is dirtied with soil — bacteria in soil called Clostridium tetani may infect your cut and cause tetanus, a symptom of which is muscle spasms
    • Exposure to mercury or lead

Treatment for leg cramps

The most effective remedy for leg cramps is usually to exercise your legs — this can both stop and help prevent leg cramps. 

If you are pregnant you will likely stop having leg cramps after your baby is born. 

If your leg cramps are caused by an underlying condition, treating that condition may resolve your leg cramps. For serious liver disease, this can be difficult, however, you may be prescribed muscle relaxants to help with your leg cramps. 

If you have idiopathic leg cramps ie where the cause is unknown, exercise and painkillers can help. 

Treating leg cramps during a cramp

Home remedies for leg cramps involve stretching and massaging your affected muscle and applying heat (eg a hot towel or hot water bottle, taking a warm bath or shower). These can all reduce your pain and discomfort during a cramp, although cramps will usually go away by themselves anyway.

To massage your leg muscles, use one or both hands to gently knead the muscles. This will help loosen them up.

To properly stretch your leg muscles, there are several exercises you can try:

Calf extension

Stand on a step with the front half of your feet on the step and the back half (your heels) hanging off it. Now, gradually lower your heels below the level of the step and hold this position for several seconds. Then lift your heels back up to the level of the step. Repeat this several times.

Ankle stretch

With your leg straight, bend your ankle so that your foot lifts upwards and your toes point towards your shin. Hold this position for several seconds and then bend your ankle back down so your foot is at 90 degrees to your lower leg. Repeat several times.

Heel walk

Walk around on your heels for several minutes to activate the muscle on the fronts of your lower legs (tibialis anterior), which will consequently relax your calf muscles. Make sure you have a clear path, free from any obstacles or trip hazards.

A person receives help treating a leg cramp

How to prevent leg cramps

Stretching exercises

Stretching your leg muscles regularly can reduce how often you have leg cramps and/or how severe they are but may not completely stop them. It can take at least a week of daily exercises before your leg cramps lessen so try a two to four week exercise programme.

Make sure you stretch your leg muscles before bedtime and after exercise. You can try the exercises listed above (under ‘Treating leg cramps during a cramp’) as well as the following wall exercise.

Stand about one metre away from a wall, keep the soles of your feet flat on the floor and lean forward to touch the wall with outstretched arms. Hold this position for five seconds and then come away from the wall. Repeat this exercise for five minutes.

Bedtime adjustments

In addition to stretching out your leg muscles before bedtime, it helps to adjust your sleeping position.

If you sleep on your back, ensure your toes are pointed upwards. You can prop the soles of your feet up against a pillow at the end of your bed to help with this. Alternatively, you can place a pillow under your knees, which will bend them up slightly and help keep your toes pointing upwards. If you sleep on your belly, dangle your feet over the edge of the bed to help prevent your calf muscles from contracting and tensing.

Make sure your bed sheets and blankets are loose so you can move freely at night.

Lifestyle changes

Stay hydrated by drinking lots of fluids and adjusting how much you drink depending on your activity levels, the weather and whether or not you are taking certain medications.

Try some gentle exercise on a stationary bike before bedtime — pedalling can loosen up your leg muscles.

Wear supportive footwear especially if you have flat feet — this will help avoid aggravating any nerve or muscle issues in your legs.

Medications for leg cramps

Medication is usually only needed for leg cramps that do not get better with exercise. Painkillers can be taken to reduce tenderness and soreness after a cramp but won’t provide any relief during a cramp as the painkillers won’t start working until after the cramp has passed.  

Quinine for leg cramps

Quinine is the main medication prescribed for persistent leg cramps that don’t resolve with exercise. However, it’s not suitable for everyone and your GP will therefore assess whether it is safe and appropriate for you, as well as explain the risks.

Quinine was first used to treat malaria but also can reduce how often leg cramps occur. Side effects of quinine include:

  • Headaches, confusion and nausea 
  • Hot flushes 
  • Impaired hearing and tinnitus (a ringing sound in your ears)
  • Impaired vision 
  • Thrombocytopenia — this is rare but is a serious complication where the level of platelets in your blood, which are needed for clotting, drops significantly 

If you are prescribed quinine by your doctor, always follow the dosage recommended and never take more than this. Overdosing on quinine can cause blindness and death. 

Given the risks associated with quinine, your doctor will only prescribe it for your leg cramps if there are significant benefits for your life that outweigh the risks. They will, therefore, only prescribe quinine if: 

  • You have frequent leg cramps that are lowering your quality of life
  • You have tried the recommended stretching exercises for an appropriate period of time and they have not reduced your leg cramps

You will receive a four-week prescription of quinine. If your leg cramps do not improve in those four weeks, you will no longer be treated with quinine.

Other medications for leg cramps

Although magnesium for leg cramps and other medications, such as diltiazem, naftidrofuryl, orphenadrine, verapamil, vitamin B complex and vitamin E, have been tried to treat leg cramps, they are not recommended. This is because studies show they are not effective in most people.

However, if quinine doesn’t work to resolve your leg cramps or you experience serious side effects, your doctor may suggest trying one of these medications.

Leg cramps FAQs

How do you stop leg cramps fast?

Leg cramps usually don’t last any longer than 10 minutes. However, during this time you can ease your leg cramps by exercising, specifically stretching out your leg muscles. You can also try massaging your leg muscles and/or applying heat using a hot towel or water bottle, or by taking a warm bath or shower. 

What causes leg cramps in bed?

You may have leg cramps in bed at night if you sleep with your knees slightly bent and your toes pointing downwards. This shortens your calf muscles and makes cramps more likely. You may also have nighttime leg cramps if you spend the day standing up for a long time. 

Can leg cramps be a sign of something serious?

Leg cramps are not usually a sign of something more serious. However, if you have persistent leg cramps, leg cramps that last longer than 10 minutes, leg cramps alongside swelling or numbness, or your leg cramps are affecting your quality of life, you should see a doctor. Blood poisoning, tetanus infection and certain diseases (eg liver disease, thyroid disease) can all cause leg cramps. 

What is the best vitamin for leg cramps?

There is currently no clear evidence that vitamin deficiencies cause leg cramps. However, some people find taking vitamin B1 or vitamin B12 helps. Speak to your doctor before taking any vitamin supplements to make sure you don’t take more than the recommended daily allowance.

What is your body lacking when you have leg cramps?

Leg cramps are usually caused by strained or tense leg muscles. However, in some cases dehydration, which lowers your salt levels (eg low sodium and potassium levels), can cause leg cramps. 

What can I drink for leg cramps?

Staying hydrated is important as dehydration can cause leg cramps. So make sure you drink enough fluids, such as water or juice. Do not drink alcohol to hydrate yourself as alcohol will dehydrate your body. Similarly don’t drink too much coffee, as caffeine can, in excess, cause dehydration. 

How can I stop my legs from cramping at night?

Make sure you stretch your leg muscles before bedtime and try to sleep in a position that does not tense up your leg muscles. If you sleep on your back, keep your toes pointed upwards by either placing a pillow under your knees or placing the soles of your feet flat against a pillow at the end of your bed. If you sleep on your front, dangle your feet over the edge of the bed. 

Can too much sugar cause leg cramps?

In people with type 2 diabetes, muscle cramps are more common both when blood sugar levels drop too low or rise too high. High blood sugar levels trigger the body to get rid of the excess glucose, which is removed via urine alongside water and other salts. This results in dehydration which causes muscle cramps. 

Can leg cramps be a sign of blood clots?

Throbbing or cramping pain in your leg can be a sign of a blood clot if it occurs alongside redness, swelling and warmth in your leg. If you experience these symptoms call 111. 

Does drinking water before bed prevent leg cramps?

If the cause of your leg cramps is dehydration, drinking water before bedtime can help. 

Can B12 deficiency cause leg cramps?

Some people with a vitamin B12 deficiency sometimes have muscle cramps, including leg cramps. 

Does magnesium help leg cramps?

Magnesium has been tried to treat leg cramps but studies show it is not effective for most people. However, in persistent or severe cases of leg cramps where exercise and quinine treatment are ineffective, your doctor may suggest trying magnesium.

We hope you've found this article useful, however, it cannot be a substitute for a consultation with a specialist

If you're concerned about symptoms you're experiencing or require further information on the subject, talk to a GP or see an expert consultant at your local Spire hospital.

Make an enquiry

Need help with appointments, quotes or general information?

Enquire online
or Find a specialist near you

View our consultants to find the specialist that's right for you.

Find a specialist

Author Information

Cahoot Care Marketing

Niched in the care sector, Cahoot Care Marketing offers a full range of marketing services for care businesses including: SEO, social media, websites and video marketing, specialising in copywriting and content marketing.

Over the last five years Cahoot Care Marketing has built an experienced team of writers and editors, with broad and deep expertise on a range of care topics. They provide a responsive, efficient and comprehensive service, ensuring content is on brand and in line with relevant medical guidelines.

Their writers and editors include care sector workers, healthcare copywriting specialists and NHS trainers, who thoroughly research all topics using reputable sources including the NHS, NICE, relevant Royal Colleges and medical associations.

The Spire Content Hub project was managed by:

Lux Fatimathas, Editor and Project Manager

Lux has a BSc(Hons) in Neuroscience from UCL, a PhD in Cellular and Molecular Biology from the UCL Institute of Ophthalmology and experience as a postdoctoral researcher in developmental biology. She has a clear and extensive understanding of the biological and medical sciences. Having worked in scientific publishing for BioMed Central and as a writer for the UK’s Medical Research Council and the National University of Singapore, she is able to clearly communicate complex concepts.

Catriona Shaw, Lead Editor

Catriona has an English degree from the University of Southampton and more than 12 years’ experience copy editing across a range of complex topics. She works with a diverse team of writers to create clear and compelling copy to educate and inform.

Alfie Jones, Director — Cahoot Care Marketing

Alfie has a creative writing degree from UCF and initially worked as a carer before supporting his family’s care training business with copywriting and general marketing. He has worked in content marketing and the care sector for over 10 years and overseen a diverse range of care content projects, building a strong team of specialist writers and marketing creatives after founding Cahoot in 2016.