Skip to main content

Muscles and movement

Muscle spasms: causes, treatment and when to see a doctor

A muscle spasm is a sudden, involuntary tightening of a muscle. Most are harmless and short-lived: the NHS says leg cramps last from a few seconds to 10 minutes. Common triggers include strain from exercise, dehydration, pregnancy, some medicines and age. Stretching and massage help. See a GP if spasms are frequent, disturb sleep or come with weakness or numbness.

Last checked: 2026-10-18

Key facts

At a glance.

  • What it is

    A leg cramp is a muscle that tightens and causes a sudden pain that can make it hard to move, according to the NHS. Cramps are common and usually harmless.

  • How long it lasts

    The NHS says cramps can last from a few seconds to 10 minutes. The muscle may feel sore for up to 24 hours afterwards.

  • Common causes

    The NHS lists ageing, too much strain on muscles during exercise, pregnancy, certain medicines such as statins and diuretics, dehydration and liver disease from heavy drinking. For some cramps the reason is unknown.

  • What helps

    The NHS says stretching and massaging the muscle may ease the pain, and standing up and putting weight on the leg may also help. Paracetamol or ibuprofen can help the soreness afterwards.

  • Mostly benign

    A NHS Scotland GP factsheet says muscle twitching and cramps are common normal symptoms, occasionally indicating an underlying neurological condition but nearly always benign.

  • When to see a GP

    The NHS says see a GP if cramps disturb your sleep, you have numbness or swelling in your legs, or cramps last longer than 10 minutes.

What causes muscle spasms?

The NHS says leg cramps can sometimes be caused by ageing, putting too much strain on muscles during exercise (which can be worse in hot or humid weather), pregnancy (usually in the later stages), certain medicines (for example statins for cholesterol or diuretics for high blood pressure), not drinking enough fluids and liver disease because of drinking too much alcohol. The reason for some cramps is unknown.

NHS inform divides leg cramps into idiopathic cramps, with no clear cause, and secondary cramps caused by another condition. It says idiopathic cramps may be caused by abnormal nerve activity during sleep, excessive strain on muscles, or a sudden restriction in blood supply, and that tendons shorten with age, which may explain why older people are particularly affected.

Secondary causes listed by NHS inform include pregnancy, exercise (cramps are often experienced when resting after exercise), neurological conditions such as motor neurone disease or peripheral neuropathy, liver disease, infections such as tetanus, toxins such as lead or mercury, and dehydration, which can lower salt levels and trigger cramps.

A NHS Scotland GP factsheet says an isolated painful muscle cramp is usually benign and commonly worsened by exercise, dehydration or pregnancy, and especially sleep in elderly people. Occasionally, when profound or associated with other symptoms such as weakness, cramps may indicate an underlying neuromuscular disease, and metabolic disorders may also cause cramp.

How do you treat or stop a muscle spasm?

During a cramp, the NHS says stretching and massaging the muscle may ease the pain, although most cramps go away without you doing anything. Standing up and putting your weight on the leg with the cramp may also help. Paracetamol or ibuprofen can ease soreness after a cramp but will not help while it is happening, as they take too long to work.

To help prevent calf cramps, the NHS suggests regular calf stretches, which may reduce cramps though they may not stop them completely. It describes standing facing a wall with your hands against it, leaning forward until you feel the calf stretch, holding for 2 or 3 seconds, and repeating for about 5 minutes, 3 times a day, with the last time just before bed.

A GP will examine you to find the cause and suggest treatment, which might be stretching exercises or quinine tablets if exercise has not helped. The NHS says quinine is not suitable for everyone and your GP will discuss risks and side effects. NHS inform says medication is usually only needed in persistent cases where cramping does not respond to exercise.

The NHS Scotland GP factsheet suggests calf muscle stretches before bed and reducing diuretics and caffeine, with a short course of quinine if recommended. If you think a medicine is causing cramps, speak to your pharmacist or prescriber and do not stop it on your own.

Common situations and what the NHS sources say
SituationWhat may helpSource
Cramp happening nowStretch, massage, stand and put weight on the legNHS
Sore muscle afterwardsParacetamol or ibuprofenNHS
Night-time calf crampsRegular calf stretches, last one before bedNHS
Cramps in pregnancyThey should pass after the baby is bornNHS inform
Cramps with a medicine you takeSpeak to your pharmacist or prescriber; do not stop it yourselfNHS
Frequent or persistent crampsSee a GP; quinine may be considered if exercise has not helpedNHS

How long do muscle spasms last?

The NHS says leg cramps can last from a few seconds to 10 minutes, and after a cramp the muscle may feel sore for up to 24 hours. NHS inform says thigh muscle cramps tend to last longest, and that you may have pain and tenderness in your leg for several hours afterwards.

For back pain caused by a pulled muscle, the NHS says back pain often improves on its own within a few weeks, although it can sometimes last longer or keep coming back. A cramp lasting longer than 10 minutes should be checked by a GP, according to the NHS.

Muscle spasms in the back

The NHS says a common cause of back pain is an injury like a pulled muscle (strain), and that it usually improves within a few weeks. The NHS advises staying active and continuing daily activities, not staying in bed for long periods, and using a heat pack or hot water bottle wrapped in a tea towel to relieve joint stiffness or muscle spasms, or an ice pack to reduce pain and swelling. It says anti-inflammatory medicine like ibuprofen may help but is not suitable for everyone, so check with a pharmacist or GP if unsure.

Urgent signs are listed by the NHS. Ask for an urgent GP appointment or get help from NHS 111 if you have back pain and feel hot, cold, shivery or generally unwell, or the pain is severe, starts suddenly or is getting worse quickly. Call 999 or go to A&E if you have back pain and pain, tingling, weakness or numbness in both legs, loss of feeling around the genitals or anus, or changes in bladder or bowel control.

Twitches, spasms from nerve conditions and how they differ

The NHS Scotland GP factsheet distinguishes several kinds of muscle activity. Cramps are sudden involuntary painful contractions of one muscle. Fasciculations are visible or felt twitches, most commonly in the calves and after exercise, nearly always benign, although health-related anxiety can amplify them. Myokymia is painless repetitive twitching, often around the eye. Myotonia is rare stiffness with an inability to relax a muscle and suggests an underlying neuromuscular disease.

The NHS lists muscle cramps, spasms and stiffness among the common symptoms of multiple sclerosis, and says muscle relaxant medicine may be used for MS spasms. The NHS defines dystonia as uncontrolled and sometimes painful muscle movements (spasms), including cramps, twisting into unusual positions, tremor and uncontrolled blinking, and says it can affect the neck, eyes or voice box among other areas.

The GP factsheet says to seek neurology advice if cramps are unusually profound or debilitating, or associated symptoms, notably weakness.

When to see a doctor

The NHS says to see a GP if leg cramps are disturbing your sleep, you also have numbness or swelling in your legs, or cramps last longer than 10 minutes. NHS inform adds that you should speak to your GP if cramps are affecting your quality of life, are frequent, or your leg muscles are shrinking or becoming weaker.

NHS inform says to contact your GP practice urgently if cramps last longer than 10 minutes and do not get better when you start to move your leg, or if they develop after you come into contact with a substance like mercury, lead or dirt that gets into a cut. If your GP is closed, phone NHS 111. Use 999 for the back-pain warning signs above.

A GP may ask about other symptoms and, if a secondary cause is suspected, arrange blood and urine tests (NHS inform). The NHS Scotland GP factsheet mentions checking electrolytes, calcium and thyroid function in primary care.

Muscle spasms in pregnancy, and fluids

The NHS lists pregnancy, usually in the later stages, as a cause of leg cramps, and NHS inform says cramps during pregnancy should pass after the baby is born. NHS inform explains that the extra weight of pregnancy can place strain on the leg muscles. Mention troublesome cramps to your midwife.

Both the NHS and NHS inform list dehydration among causes, and NHS inform says low water levels in the body can lead to a drop in salt levels that may trigger cramps. Drinking enough fluids is a sensible step. The sources do not recommend specific supplements.

NHS and private pathways

On the NHS, cramps and spasms are usually assessed by a GP, with physiotherapy for recurrent muscle problems, and neurology if a nerve or muscle condition is suspected. Pharmacists can advise on medicines that may cause cramps.

Private physiotherapy, sports medicine and neurology appointments are available for those who want quicker access. Any route should start with checking for the red-flag features above.

Frequently asked

Questions people ask.

Quick, plain-English answers to the questions we hear most.

  • What causes muscle spasms?

    The NHS lists ageing, strain during exercise, pregnancy, certain medicines such as statins and diuretics, dehydration and liver disease from heavy drinking. For some cramps the cause is unknown. Nerve conditions can also cause spasms.

  • How long do muscle spasms last?

    The NHS says leg cramps last from a few seconds to 10 minutes, and the muscle can feel sore for up to 24 hours afterwards. A cramp lasting longer than 10 minutes should be checked by a GP.

  • What stops a muscle spasm quickly?

    The NHS says stretching and massaging the muscle may ease the pain. Standing up and putting your weight on the leg may also help. Painkillers will not help during the cramp, only with soreness afterwards.

  • Why do I get muscle spasms at night?

    The NHS says most people get leg cramps at night or when resting. NHS inform says abnormal nerve activity during sleep, and shortening tendons with age, may explain some. Regular calf stretches before bed may reduce them.

  • Can dehydration cause muscle spasms?

    Yes. The NHS lists not drinking enough fluids as a cause of leg cramps. NHS inform says low body water can reduce salt levels and trigger cramps in some people.

  • Can medicines cause muscle spasms?

    Yes. The NHS gives statins and diuretics as examples. Speak to your pharmacist or prescriber if you think a medicine is responsible, and do not stop a prescribed medicine on your own.

  • What is a back muscle spasm?

    A common cause of back pain is a pulled muscle. The NHS says back pain often improves within a few weeks. Get urgent help for numbness around the genitals, bladder or bowel changes, or weakness in both legs.

  • Are muscle spasms a sign of something serious?

    Rarely. A NHS Scotland GP factsheet says twitches and cramps are common and nearly always benign, but profound cramps or those with weakness may point to a neuromuscular condition and need review.

  • Do muscle spasms happen in multiple sclerosis?

    Yes. The NHS lists muscle cramps, spasms and stiffness among MS symptoms and says muscle relaxant medicine may be used to relieve them. Ask your neurology team about spasticity management.

  • When should I see a GP about muscle spasms?

    See a GP if spasms disturb sleep, come with numbness or swelling, last longer than 10 minutes, happen often, or your muscles are shrinking or weakening, according to the NHS and NHS inform.

Where this comes from

Sources and checking.

This guide is for information, not medical advice.

Your GP or consultant knows your history and can tell you which parts apply to you. If your symptoms are severe, rapidly worsening, or come with red-flag features, seek urgent medical care. Figures and availability change, so treat them as a guide and confirm with the provider.

Published 2026-10-18, next review 2027-10-18.