Muscle cramps: those sudden, painful contractions that lock the muscle without warning. They arrive during physical activity, at night while you sleep, or seemingly for no reason, and they usually pass on their own, leaving the muscle sore. Understanding why they happen is the first step to preventing and managing them.
If instead of a painful cramp what you feel is a painless twitch, a spot in the muscle that moves on its own under the skin, it is a different and much more common phenomenon: a muscle that twitches: what fasciculations are.
In this guide on muscle cramps you will learn the most common causes, how to stop a cramp in progress and, above all, how to prevent them. With the right measures, you can drastically reduce how often these annoying episodes happen.
⚠ Important: read this before continuing
The exercises and advice in this article are general indications and may not be suitable for your situation. Every person has a unique clinical history: what works for others could be counterproductive for you.
Want a professional's opinion? Start from the questionnaire: you sign up and see who will follow you, a physiotherapist on the Italian professional register chosen for your case, whom you write to in chat. If you would rather hear their voice, the first consultation is free and we look at your situation together.
What a Cramp Is and How to Recognise It
Muscle cramps are involuntary, sudden and sustained contractions of a muscle or a group of muscles. Unlike a brief spasm, a cramp lasts from a few seconds to several minutes and can be extremely painful.
The most frequent target is the muscles of the legs: calves, thigh muscles and the muscles of the foot. No muscle in the body is excluded, however: a cramp can also hit the abdomen, the hands and the neck.
During the episode the muscle contracts involuntarily and cannot relax. You can often see or feel the hardened, contracted muscle. The pain can be intense and the muscle can stay sore even after the cramp has passed.
Main Causes
Dehydration is one of the most common causes. When the body loses fluid through sweat, electrolytes (sodium, potassium, magnesium) also drop. These minerals are essential for correct muscle contraction and relaxation.
Muscle fatigue also has a direct role. When a muscle is overloaded by exercise, the neuromuscular control mechanisms can be disturbed, leading to involuntary contractions. This explains why cramps often arrive towards the end of an intense activity.
Mineral deficiency is another frequent cause, even without dehydration. Low levels of potassium, magnesium or calcium in the blood interfere with muscle function. This is especially important for people who sweat a lot or take diuretics.
An important point: before trying these exercises, make sure you have received a correct diagnosis. People often think they have one problem, but the real cause of the pain is another. Doing the wrong exercises can make the situation worse instead of better.
Some medical conditions create a favourable ground: diabetes, thyroid disease, circulation problems and some medicines. Frequent night cramps in older people deserve a medical check.

How to Stop Them
When a cramp arrives, the priority is to get the muscle to relax. Here is what to do, in order of effectiveness, to stop it:
Gentle stretching is the most effective remedy of all. Slowly lengthen the contracted muscle in the opposite direction to the contraction. For a calf cramp, pull your toes towards you. Hold the stretch until the cramp releases.
Massage can also bring relief, on its own or right after stretching. Massage the contracted muscle gently with circular movements and moderate pressure. This can help relax the muscle fibres.
Heat is the card to play with the most stubborn episodes. If the cramp does not pass with stretching and massage, apply a hot water bottle or a warm compress to the muscle. Heat encourages muscle relaxation.
Prevention
Adequate hydration is the first preventive measure. Drink regularly during the day, not only when you are thirsty. During physical activity, drink before, during and after. For intense or prolonged exercise, consider electrolyte drinks.
If it is a child playing outdoors in summer who is sweating, the reasoning on fluids is the same; what needs thinking through specifically is timing, breaks and gradually getting used to the heat over the first two weeks, and we cover this in sport and heat in children: what really changes.
Regular stretching is the second measure that counts. Stretching the calves, quadriceps and hamstrings before sleeping can reduce night cramps. Stretching before and after physical activity reduces cramps linked to exercise.
A diet rich in minerals works in the same direction. Bananas, potatoes, dark leafy green vegetables, nuts and dairy products are sources of potassium, magnesium and calcium. If cramps are frequent, consider supplements after consulting a doctor.
Proper warm-up is the specific protection for sport. A prepared muscle is less susceptible to cramps. Never skip the warm-up, especially in hot or cold conditions.
Night Muscle Cramps
Night cramps are especially annoying. They often hit the calves and can wake you from deep sleep with intense pain. They become more common with age. The other time of life when they peak is the third trimester of pregnancy, where however the evidence on magnesium and stretching needs to be read separately: the picture is in leg cramps in pregnancy: why they happen and what helps.
If instead it is a child who wakes with a hard calf, both the available evidence and the way to stretch his leg change: we cover this in night cramps in children: what they really are.
To prevent them: stretch your calves before sleeping, keep your feet uncovered during sleep (bedcovers that compress the feet can encourage cramps), and avoid positions that shorten the calf.
If they wake you in the middle of the night, the quickest solution is to get up and walk. Putting weight on the foot helps lengthen the muscle. Then do gentle stretching before going back to bed. For specific exercises, see ankle exercises.
Online Physiotherapy
Physiotherapy can help if the episodes are frequent or linked to muscle imbalances. A physiotherapist can identify chronic muscle tension, teach effective stretching techniques and assess any postural problems that contribute to the cramps.
Remote rehabilitation also works well in these cases, because almost all the work is movement and stretching. The physiotherapist can guide you through personalised stretching routines and give you advice on prevention and management.
With Ri-Hub you can access online physiotherapy sessions for just 29,90€. Our physiotherapists can help you reduce how often cramps happen, with a personalised approach.
When to Be Concerned
Most muscle cramps are harmless, but some cases need medical attention. See a doctor if the cramps are very frequent (several times a week), if they do not respond to preventive measures, if they come with swelling or weakness, or if they involve muscles other than the usual ones (the legs).
Muscle cramps that last more than 10 minutes, or that occur for no apparent reason after starting a new drug treatment, also deserve an assessment. For problems related to the legs, also read calf pain.
In Summary: How to Keep Cramps Under Control
In most cases it is an annoying but preventable and manageable disorder. Adequate hydration, regular stretching, a diet rich in minerals and warm-up before sport are the keys to prevention. When they arrive, gentle stretching and massage resolve them quickly.
Do cramps happen to you often, even several times a week? With Ri-Hub you can start an online physiotherapy programme, for just 29,90€ per session. Our physiotherapists can help you identify the causes and prevent them effectively. Book your first session and free your muscles.
You might also be interested in:
Knee Pain: All the Causes, How to Recognise Them and What to Do Shoulder Calcification: Causes, Symptoms, Treatment and Exercises Disc Protrusion Exercises: Effective Movements for Recovery
Stay in touch with us Join our dedicated Facebook group: we reply to all patients, give practical advice and clear up the most common doubts.
If your muscle aches started when you began taking a statin, the picture needs to be read differently: we cover this in Statins and muscle pain: what the studies really say.
Sources
- Non-drug therapies for the secondary prevention of lower limb muscle cramps: The Cochrane database of systematic reviews, 2021
- Magnesium for skeletal muscle cramps: The Cochrane database of systematic reviews, 2020
Last source check: September 2026.
Need a consultation?
Start from the questionnaire on Ri-Hub: a few questions about your case, you sign up, and you see who will follow you: a physiotherapist on the Italian professional register, whom you write to in chat whenever you like. If you prefer to talk it through by voice, the first consultation is free, lasts twenty minutes and commits you to nothing: they arrive having already read what you wrote, and together you decide whether and how to continue.





