What causes leg cramps?

25th June, 2019 • 5 min read

Leg cramps occur when the muscles in your leg or foot tighten and shorten. They can be quite painful, but are normally harmless.

Usually leg cramps will only last a few seconds before the muscles relax again, but they can last up to 10 minutes.

Muscle cramps can be caused by an underlying condition, but often the cause is unknown. These are called idiopathic leg cramps.

Leg cramps can also be caused by certain medications. If your muscle cramps are caused by any medications you are taking, speak to your doctor. Never stop taking prescribed medication without talking to a doctor first.

Other types of muscle cramps can be addressed with self-care measures, including stretching and taking painkillers.

However, you should speak to a pharmacist or doctor for further guidance before taking any painkillers or another medication for muscle cramps.

Here you will find the different causes of leg cramps, how to treat them and when to worry about leg cramps.

Leg cramps without a known cause

Leg cramps that don’t have a known cause are called idiopathic leg cramps. There are some theories that they might be caused by:

  • the leg muscles seizing at night due to unusual nerve activity
  • your leg muscles being overused
  • a restricted blood supply to your leg muscles
  • ageing, as tendons will shorten throughout a person’s life, if they become too short they may cause the muscles to cramp

Despite the cause being unknown, idiopathic leg cramps can often be resolved with self-care measures which will be discussed below.

Causes of secondary leg cramp

Cramps that have a known cause are called secondary cramps.

They can be caused by:

  • pregnancy - the extra weight due to pregnancy can put an added strain on your leg muscles
  • exercise
  • neurological conditions, such as
    motor neurone disease
  • liver disease can lead to a build-up of toxins which may cause cramps
  • infections, such as
  • toxins, such as lead or mercury, may build up in your blood and cause muscle cramps
  • dehydration
    can result in low salt levels, which causes your muscles to cramp

These cramps can sometimes be resolved by addressing the underlying condition, but self-care measures can also be effective.

Medications which cause cramp

In a few people, certain medications can cause leg cramps, including:

  • diuretics
  • statins
  • raloxifene
  • nifedipine
  • nicotinic acid

If you're concerned that medication is causing your leg cramps, speak to a doctor.

You should always speak to a pharmacist or doctor for guidance before taking any medication.

How to stop leg cramps

If the cause of your leg cramps is unknown, there are some self-care measures you can take, such as stretching and massaging the muscle.

To prevent leg cramps from happening so frequently, you can try:

  • stretching the muscle that is cramping at least three times a day
  • sleeping with your feet propped up if you are lying on your back, or hanging over the edge of the bed if you are lying on your tummy, to try and prevent toes from pointing down
  • avoiding heavy blankets when you sleep

Muscle cramps can be quite painful, and sometimes your muscles can remain sore for several hours after cramping. You may want to take painkillers, such as paracetamol (if you're not allergic to these medications and don’t have any medical conditions that do not allow you to take these medications), to alleviate the pain experienced after cramping.

However, speak to a pharmacist or doctor for further guidance before taking any painkillers or another medication.

It can be more challenging to resolve cramps caused by an underlying condition, particularly liver disease. If self-care measures are not sufficient then a doctor may prescribe a muscle relaxant to help relieve your symptoms.

In rare cases you may be prescribed quinine to prevent leg cramps, but there can be serious side effects so it is best to try self-care measures first.

When to worry about leg cramps

You should see a doctor immediately or go to your nearest hospital if:

  • you have swelling, pain, and tenderness in one or both of your legs and/or the skin feels warm and looks red
  • your symptoms suddenly get worse
  • you have numbness or pins and needles in your legs or poor balance when walking
  • your leg cramps last longer than 10 minutes
  • there is a possibility that you have a tetanus infection from a wound

You should see a doctor within 48 hours if:

  • you have pain in your legs, especially pain that gets worse during exercise and is relieved by rest
  • you have a feeling of inner restlessness and a compelling need to be in constant motion
  • you take anti-psychotic medication or any other medication

You should see a doctor if:

  • you're worried about your symptoms and about the possibility of other medical conditions causing your leg cramps (secondary causes of leg cramps)
  • you're distressed by your symptoms or they are affecting your daily functioning


Anyone who has experienced leg cramps knows how painful they can be, so taking steps to prevent them is crucial.

Take the time to stretch the affected muscle, stay hydrated, and prevent your toes from pointing down when you sleep.

If you’re at all concerned about your leg cramps, or you experience any worrying signs (as listed above) then you should see a doctor.

Important: Our website provides useful information but is not a substitute for medical advice. You should always seek the advice of your doctor when making decisions about your health.