Why Do I Get Leg Cramps at Night?
Why leg cramps strike at night, from muscle fatigue and dehydration to pregnancy and medications, plus stretches that help, the truth about magnesium and quinine, and how cramps differ from a clot.

The short answer
Nighttime leg cramps are sudden, painful tightenings of a calf, foot, or thigh muscle during rest or sleep. They are often linked to muscle fatigue, dehydration, older age, pregnancy, or certain medications, though many have no clear cause. Stretching the muscle usually ends a cramp within minutes. Quinine should not be used, and lasting leg swelling needs prompt care.
Key takeaways
- Nocturnal leg cramps are sudden, involuntary tightenings of a calf, foot, or thigh muscle that usually last from a few seconds to several minutes.
- Muscle fatigue, dehydration, older age, pregnancy, and some medications such as diuretics are all linked to night cramps, though many have no clear cause.
- Straightening your leg and pulling your toes toward your shin, or standing with your weight on the leg, is usually the fastest way to release a calf cramp.
- Stretching your calves before bed, drinking fluids through the day, and loosening tight bedcovers may reduce how often cramps happen.
- Magnesium supplements are unlikely to help typical night cramps in older adults, and they can cause diarrhea and build up in people with reduced kidney function.
- The FDA warns against using quinine for leg cramps because it has not been shown to work and can cause serious, life-threatening side effects.
- Restless legs syndrome causes an urge to move rather than a locked muscle, while a blood clot causes pain and swelling, usually in one leg, that does not go away.
- Sudden shortness of breath or chest pain alongside a painful, swollen leg is a reason to call 911.
You are fast asleep when your calf suddenly locks into a hard, painful knot and jolts you awake. Nighttime leg cramps are common, especially as people get older and during pregnancy, and although they feel alarming, most are harmless and pass within minutes.
This article explains what these cramps are, what tends to set them off, what actually helps, and how to tell a cramp apart from restless legs syndrome or a blood clot. It can help you understand what is happening and decide what to do next, but it cannot diagnose the cause of your symptoms.
What are nocturnal leg cramps?
Nocturnal leg cramps are sudden, involuntary, painful tightenings of a leg muscle that happen while you are resting or asleep. They most often strike the calf, but they can also affect the muscles of the foot or thigh, and they usually last from a few seconds to several minutes.
MedlinePlus describes a muscle cramp as a muscle that contracts on its own and will not relax. A calf cramp is often called a charley horse. During a cramp you may see or feel the muscle bunch into a hard lump, and your toes may curl or point downward.
The sharp pain usually fades once the muscle lets go, but the area can stay sore or tender for hours afterward. Cramps are one of the everyday body signals covered in our complete guide to physical health, and on their own they are rarely a sign of something serious.
Why do leg cramps happen at night?
Often there is no single clear reason. Many night cramps are idiopathic, meaning no specific cause can be found, but several factors are consistently linked to them, and more than one may be at work at once.
Muscle fatigue and overuse
According to MedlinePlus, overworking or straining a muscle is the most common cause of cramps. A long run, a new workout, or a day spent on your feet can show up as a cramp that night, which is one reason recovery and rest days matter. Holding a muscle in the same position for a long time can have a similar effect.
Low fluids and minerals
Not drinking enough, or losing fluid through heavy sweating, illness, or alcohol, is linked with cramps. Low blood levels of potassium, calcium, or magnesium can also play a part, and a simple blood test can check for these.
Getting older
Night cramps become more common with age, and MedlinePlus lists older adults among the groups most likely to get them. One possible reason is that muscles and tendons gradually lose some length and flexibility over time.
Pregnancy
Leg cramps are a familiar complaint in pregnancy, particularly in the later months. The reasons are not fully understood; extra weight, changes in circulation, and shifts in minerals have all been suggested.
How you lie in bed
Sleeping with your feet pointed, often under a tight, tucked-in sheet, keeps the calf muscle in a shortened position for hours. That may make it easier for the muscle to cramp when you move.
Which medications and health conditions are linked to leg cramps?
Some medicines and some medical conditions make leg cramps more likely, so it is worth looking at both if your cramps are new or frequent. MedlinePlus lists certain medications among the causes of muscle cramps, alongside conditions that affect the nerves, blood flow, the thyroid, and the kidneys.
| Possible factor | How it may be linked | What you can do |
|---|---|---|
| Diuretics (water pills) | Can lower fluid levels and minerals such as potassium and magnesium | Ask your doctor whether a blood test or a change in dose makes sense |
| Statins (cholesterol-lowering drugs) | Muscle aches and cramps are a known side effect for some people | Report new muscle pain, especially with weakness or dark urine |
| Other prescriptions | A range of other medicines have been linked with cramps in some people | Bring a full list of medicines and supplements to your appointment |
| Pressure on a nerve, such as a pinched nerve in the lower back | An irritated nerve can trigger muscle spasms in the leg | See your doctor, especially if you also have back pain, numbness, or weakness |
| Poor blood flow to the legs (peripheral artery disease) | Narrowed arteries can cause cramping calf pain during walking that eases with rest | Book an appointment, because this needs evaluation |
| Underactive thyroid (hypothyroidism) | A slow thyroid is a recognized cause of muscle cramps | A blood test can check your thyroid levels |
| Kidney failure or dialysis | Shifts in fluid and minerals can set off cramps | Talk to your kidney care team |
| Heavy alcohol use | Linked with cramps, dehydration, and nerve damage | Cutting back may help; ask for support if that is hard |
If your cramps started soon after you began a new medicine, mention the timing to your doctor or pharmacist. Do not stop a prescribed medicine on your own, because the condition it treats may matter more than the cramps, and there are often alternatives to try.
How do you stop a leg cramp when it hits?
The fastest relief usually comes from gently stretching the cramping muscle in the opposite direction to the pull. For a calf cramp, that means straightening your knee and drawing your toes up toward your shin.
- Flex your foot. Straighten your leg and pull your toes toward you, using your hand or a towel looped around the ball of your foot if you can reach.
- Stand on it. Get up and put your weight on the cramping leg, pressing your heel into the floor. Walking a few steps can help the muscle release.
- Massage the muscle. Rub the knot gently with your hands until it softens.
- Use warmth, then cold. MedlinePlus suggests heat on a tight muscle, such as a warm towel or a warm shower, and ice on a muscle that is sore afterward.
- Stretch the thigh if that is where it hurts. For a cramp in the back of the thigh, straighten your leg. For the front of the thigh, hold onto something for balance and gently draw your heel toward your buttock.
Leftover soreness usually settles within a day. An over-the-counter pain reliever such as acetaminophen or ibuprofen can ease it, but check with your doctor or pharmacist first if you are pregnant, take other medicines, or have kidney, stomach, or liver problems.
How can you prevent leg cramps at night?
There is no guaranteed way to prevent night cramps, but a few simple habits may reduce how often they happen. MedlinePlus suggests stretching your leg muscles before bed and drinking plenty of fluids if you often get cramps at night.
- Stretch your calves before bed. Stand facing a wall with one foot a step behind the other, keep the back heel on the floor, and lean forward until you feel a stretch in the back calf. Hold for about 30 seconds and switch sides.
- Spread your fluids through the day. A big drink right before bed may just wake you up to urinate. Pale yellow urine is a reasonable sign you are drinking enough.
- Loosen the covers. Untuck the sheet at the foot of the bed so your toes are not pushed into a pointed position all night.
- Build up exercise gradually. Big jumps in distance, intensity, or new movements are more likely to leave tired muscles that cramp later.
- Go easy on alcohol, which can leave you dehydrated.
- Eat mineral-rich foods. Leafy greens, beans, nuts, whole grains, bananas, and dairy foods supply magnesium, potassium, and calcium.
- Move during the day if you sit a lot. Short walks and calf raises keep the muscles from staying in one position for hours.
How much fluid you need depends on heat, activity, and your health, and separating hydration myths from facts can help you drink enough without overdoing it.
Does magnesium or quinine help leg cramps?
Magnesium is unlikely to help typical night cramps for most adults, and quinine should not be used for cramps at all. Both are widely recommended online, so it helps to know where the evidence stands.
Magnesium
Magnesium is a mineral your muscles and nerves need to work properly, and MedlinePlus lists muscle cramps among the signs of low magnesium. It is easy to see why supplements are popular. However, reviews of clinical trials have generally found that magnesium supplements do not reliably prevent ordinary night cramps in older adults, and the evidence in pregnancy is mixed.
If a blood test shows your magnesium is low, correcting it makes sense. Otherwise, food sources are a safer starting point than a supplement. Magnesium supplements can cause diarrhea, and people with reduced kidney function can build up too much, so talk to your doctor before taking them.
Quinine
Quinine is a drug approved in the US only to treat a type of malaria, and the FDA warns against using it for leg cramps. According to the FDA, unapproved quinine products were once widely sold for leg cramps and were removed from the market, and the approved version carries a boxed warning, the FDA's strongest, about life-threatening dangers when it is used for nighttime cramps.
The MedlinePlus quinine drug information page states plainly that quinine should not be used to treat or prevent nighttime leg cramps. It has not been shown to work for this purpose, and it can cause severe bleeding problems, kidney damage, irregular heartbeat, and serious allergic reactions.
Tonic water contains only a small amount of quinine, and there is no good evidence that it prevents cramps. People who have had a reaction to quinine can react again, even to a small amount from another source.
| Remedy | What the evidence says | Bottom line |
|---|---|---|
| Stretching before bed | Low risk and widely recommended; study results are mixed | Worth trying |
| Drinking enough fluid | Helps when dehydration is part of the picture | Worth doing |
| Magnesium supplements | Unlikely to help typical night cramps in older adults; mixed in pregnancy | Talk to your doctor first |
| Quinine tablets | Not shown to work for cramps; the FDA warns of serious, life-threatening side effects | Do not use for cramps |
| Tonic water | Contains a small amount of quinine; no good evidence it prevents cramps | Not a treatment |
| Pickle juice or mustard | Little solid evidence | Fine for most people in small amounts, but do not rely on it |
| Prescription medicines for cramps | MedlinePlus notes they are not always effective and may cause side effects | Only after weighing pros and cons with your doctor |
Is it a leg cramp, restless legs, or a blood clot?
A cramp is a hard, painful tightening that releases within minutes, restless legs syndrome is an uncomfortable urge to move with no locked muscle, and a blood clot causes pain and swelling that does not go away. Telling them apart matters, because a clot needs urgent medical care.
Restless legs syndrome
Restless legs syndrome (RLS) is a condition that causes a powerful urge to move your legs, usually when you are sitting or lying down in the evening. MedlinePlus describes the feeling as creeping, crawling, tingling, or burning, and moving your legs brings brief relief. There is no knotted muscle, which is the key difference from a cramp.
Deep vein thrombosis
Deep vein thrombosis (DVT) is a blood clot in a deep vein, most often in the lower leg or thigh. According to MedlinePlus, it can cause pain or swelling, warmth and tenderness over the vein, and red skin. Unlike a cramp, the pain does not release after a few minutes of stretching, and swelling in one leg is an important clue.
A clot can break loose and travel to the lungs, which is called a pulmonary embolism. Sudden shortness of breath, chest pain, or coughing up blood means you should call 911.
| Feature | Leg cramp | Restless legs syndrome | Blood clot (DVT) |
|---|---|---|---|
| What it feels like | Sudden, hard, painful tightening | Creeping, crawling, or tingling with an urge to move | Aching, throbbing, or cramp-like pain, often with heaviness |
| The muscle | Hard knot you can often see or feel | No knot | No knot; the leg may look swollen |
| How long it lasts | Seconds to minutes, then soreness | Comes and goes at rest, often every evening | Persists and may worsen over hours or days |
| What eases it | Stretching, standing, massage | Moving or walking, briefly | Nothing at home; needs medical care |
| Other signs | Usually none | Trouble falling or staying asleep, leg jerks in sleep | Swelling, warmth, or redness, usually in one leg |
| Next step | Self-care; see a doctor if frequent | See your doctor | Same-day care; call 911 for chest pain or breathlessness |
When should you see a doctor or call 911?
Most night cramps can be managed at home, but talk to your doctor if they are frequent, severe, or come with other symptoms. Call 911 or go to the emergency room if leg pain comes with signs that something more serious is going on.
Make an appointment with your doctor if:
- Cramps happen often or wake you several nights a week
- They are severe or do not ease with stretching and fluids
- You notice muscle weakness, numbness, or shrinking muscles alongside the cramps
- Your calf hurts when you walk and eases when you rest, which can point to poor circulation
- The cramps began after you started a new medicine
- You are pregnant and the cramps are severe or frequent
Get same-day care if your leg stays swollen, red, warm, or tender after the cramp should have passed, especially if only one leg is affected.
Call 911 or go to the emergency room for:
- Sudden shortness of breath, chest pain that worsens when you breathe in, coughing up blood, or fainting
- A leg that suddenly turns cold, pale, or numb
- Severe muscle pain and weakness together with dark, cola-colored urine, especially after intense exercise or a new medicine
Frequent cramps are also worth raising simply because of what they do to your nights. Broken sleep adds up over weeks, and the connection between sleep and mental health means poor rest can affect your mood and focus as well as your energy.
Common questions
- Why do I get leg cramps at night?
- Night leg cramps are often linked to tired or overworked muscles, not drinking enough fluid, older age, pregnancy, or medications such as diuretics. Sleeping with your feet pointed may also play a part by keeping your calf muscles shortened for hours. Many cramps have no clear cause. If they are frequent or severe, talk to your doctor, who can check for medication effects or an underlying condition.
- How do you stop a leg cramp fast?
- Stretch the muscle in the opposite direction to the cramp. For a calf cramp, straighten your leg and pull your toes toward your shin, or stand up and press your heel into the floor. Gentle massage and warmth can help the muscle relax. The cramp usually releases within minutes, though the muscle may feel sore for up to a day afterward.
- Does magnesium help with leg cramps?
- Probably not for most people. Reviews of clinical trials have generally found that magnesium supplements do not reliably prevent typical night cramps in older adults, and the evidence in pregnancy is mixed. If a blood test shows low magnesium, correcting it makes sense. Supplements can cause diarrhea and may build up in people with kidney disease, so talk to your doctor first.
- Is quinine safe for leg cramps?
- No. Quinine is approved in the US only to treat a type of malaria, and the FDA warns against using it for leg cramps. It has not been shown to work for cramps and can cause serious bleeding problems, kidney damage, irregular heartbeat, and severe allergic reactions. Tonic water contains only a small amount of quinine and is not a proven remedy.
- Are leg cramps a sign of a blood clot?
- Usually not. A cramp is a hard, painful tightening that releases within minutes. A blood clot in a deep vein tends to cause pain that lingers, along with swelling, warmth, or redness, usually in one leg. If your leg stays swollen and sore, get same-day medical care. Call 911 if you also have chest pain or sudden shortness of breath.
- What is the difference between leg cramps and restless legs?
- A leg cramp is a sudden, painful locking of a muscle that you can often see or feel as a hard knot. Restless legs syndrome causes an uncomfortable urge to move your legs, often described as creeping or crawling, that comes on when you sit or lie down and eases briefly when you move. The two need different approaches, so describe your symptoms carefully to your doctor.
- Are leg cramps common in pregnancy?
- Yes. Leg cramps are a common complaint during pregnancy, especially in the later months. Stretching your calves before bed, staying active, and drinking enough fluid may help. Check with your doctor or midwife before taking any supplement or pain reliever, and seek prompt care if one leg becomes swollen, red, or warm, because pregnancy raises the risk of blood clots.
Sources
Published research and guidance this page draws on. Check the original where a detail matters to you.
- 1Muscle Cramps: MedlinePlus health topicMedlinePlus, U.S. National Library of Medicine
- 2Muscle cramps: MedlinePlus Medical EncyclopediaMedlinePlus, U.S. National Library of Medicine
- 3Charley horse: MedlinePlus Medical EncyclopediaMedlinePlus, U.S. National Library of Medicine
- 4Quinine: MedlinePlus Drug InformationMedlinePlus, U.S. National Library of Medicine
- 5Unapproved Drugs and Patient HarmU.S. Food and Drug Administration
- 6Serious risks associated with using quinine to prevent or treat nocturnal leg crampsU.S. Food and Drug Administration
- 7Magnesium in diet: MedlinePlus Medical EncyclopediaMedlinePlus, U.S. National Library of Medicine
- 8Restless Legs: MedlinePlus health topicMedlinePlus, U.S. National Library of Medicine
- 9Deep Vein Thrombosis: MedlinePlus health topicMedlinePlus, U.S. National Library of Medicine
This article is for general education and is not a substitute for professional medical advice. Speak with a qualified healthcare provider about your individual circumstances.
About HealthPathCore
An independent health knowledge library
Every article here is built from published research and guidance issued by named health bodies, written in plain language, and dated so you can see how current it is. When the evidence moves, we come back and correct the piece.
How we research and write

