What Causes Leg Cramps at Night?

By Zina Semenovskaya, MD
Medically reviewed checkmarkMedically reviewed
May 9, 2022

Leg cramps can feel like a recurrent, painful tightening that typically occurs in your calf muscles but can also involve your feet or thighs.

Sometimes, leg cramps are called “muscle spasms” or a “charley horse.”

They often occur during sleep at night (this explains why they are also called nocturnal leg cramps). They can be painful and even incapacitating.

If you’ve experienced these cramps, you’re not alone.

About half of adults over the age of 65 have occasional nighttime leg cramps, and they’re more common among the female gender.

The exact causes of leg cramps at night are not fully known. As much as they can hurt, they’re normally harmless.

What Are Leg Cramps?

Leg cramp, also called muscle spasm, is pain felt due to the tightening of the calf, thigh, or foot muscles.

The pain is usually intense, sudden, and involuntary.

What They Feel Like

Leg cramps at night can happen whether you’re awake or asleep.

They can feel like a spasm, tightening or straining the muscles of your calf, thigh, or foot.

The most common muscle affected is your calf, but any muscle of the leg can have cramps.

Cramps can be intense enough to cause your legs or feet to move or forcefully tense up or contract.

They can even be so intense and painful that you can’t do anything else.

How Long They Last

For most people, leg cramps at night last for just a few minutes.

The average is about nine minutes per episode. Afterward, you may experience cramps again in the same night, or you could have residual pain or discomfort that lasts for hours.

Leg Cramps at Night

You’re more likely to have leg cramps at night or while you’re resting.

People with leg cramps often have problems with sleep because the cramps can wake you up and disturb a good night’s rest.

See a doctor online.

Start my visit

Leg Cramps vs. Restless Leg Syndrome

What’s the difference between leg cramps and restless legs syndrome? 

Both tend to happen at night, but restless leg syndrome feels like a crawling sensation and comes with an urge to move or shake the legs. The syndrome doesn’t cause pain or tight muscles.

Although it’s uncomfortable, restless leg syndrome is not associated with the severe pain of leg cramps.

Symptoms and Causes

Below are some of the symptoms and causes of muscle cramps.

Structural Disorders

Experts don’t know the exact mechanism of nighttime leg cramps.

But in most cases, the cramps are most likely caused by muscle fatigue, anatomical issues, and nerve problems. 

People who have nerve conditions like Parkinson’s disease tend to have more leg cramps at night. Other nerve problems could also cause an increased risk of having leg cramps.

Lumbar canal stenosis, a condition where the spinal canal in the lower part of your back is narrower, can cause pressure on your spinal cord or nerves.

People with lumbar canal stenosis tend to have more leg cramps at night.

Medications and Procedures

There are many medications that can potentially cause muscle cramps in some people, such as statins for cholesterol and diuretics for blood pressure.

Other medications may specifically increase your chances of leg cramps, but the risk is low. Here are some examples of medications that may cause leg cramps at night:

  • Intravenous (I.V.) iron sucrose
  • Conjugated estrogens
  • Raloxifene
  • Naproxen
  • Teriparatide

Some medical procedures and therapies are linked to an increased risk of leg cramps, such as cancer treatment and dialysis.

Metabolic Problems

Certain metabolic problems, or medical conditions that affect the metabolism of food and nutrients, may increase your risk of leg cramps at night. Examples include: 

Tired Muscles

Muscle fatigue or too much exercise can increase your risk of nighttime leg cramps.

Inactivity During the Day

If you sit too long during the day, such as when working at a desk for long periods of time, you’re more likely to have leg cramps at night.

Body Position While Sleeping

When laying down to sleep, your toes tend to point downward and away from your body, which flexes your calf muscles.

A pointed foot position may make you more likely to have leg cramps at night.

Older Age

Leg cramps are more common as we get older. Approximately one out of two people over the age of 60 have nighttime leg cramps.


If you’re pregnant, you’re more likely to have leg cramps at night, and they may occur more frequently later in pregnancy.

The reason for the increase in leg cramps may be due to hormonal changes, increased nutritional demands, changes in blood flow, or a combination of these factors.

Other Conditions

Other conditions that might increase your risk of nighttime leg cramps are: 

  • Heart disease
  • Problems with veins and poor circulation
  • Arthritis
  • Nervous system disorders

Management and Treatment

Even though leg cramps can be painful, they’re usually harmless.

There are different ways that healthcare professionals can help you manage and treat nighttime leg cramps.

You won’t necessarily need a blood test because there is no evidence that cramps are related to electrolyte imbalances.

However, depending on your individual medical history and associated medical conditions, your doctor may want to perform certain blood tests to evaluate for other medical-related problems.

Your doctor may also use diagnostic tests and imaging to look for problems with nerves or blood vessels that might be related to cramping.

There is no specific medication prescribed for leg cramps at night. In the past, doctors sometimes prescribed a medication called quinine, but this is no longer recommended.

Historically, quinine didn’t work well in reducing cramps, and it sometimes had severe side effects, such as bleeding and heart rhythm problems.

Depending on your other medical issues and the suspected causes of your leg cramps, your doctor might prescribe another medication.

Stretching and massaging your legs may also give you relief. Some people find that applying ice, hot packs, or taking a warm bath reduces the discomfort.

Mild exercise, rest, or sleeping in a different position may help with symptoms.

Good hydration is also very important because dehydration is associated with worsening cramping.

A small study of 28 people found that taking a vitamin B complex supplement helped with leg cramps at night.

Vitamin B complex is relatively safe for most people and may be worth trying, but there isn’t enough evidence yet to know how much it helps with cramping.

See a doctor online.

Start my visit

When to Seek Medical Care

Leg cramps can be painful, disturbing your sleep.

They’ll usually go away on their own after a few minutes.

If you notice you’re having more frequent or intense leg cramps at night, or if it’s happening at the same time as another health problem is getting worse, you should see a healthcare professional.

How K Health Can Help

Did you know you can get affordable primary care with the K Health app?

Download K Health to check your symptoms, explore conditions and treatments, and, if needed, text with a clinician in minutes. K Health’s AI-powered app is based on 20 years of clinical data.

Frequently Asked Questions

What Deficiency Causes Leg Cramps at Night?
Electrolyte imbalances or other deficiencies don’t cause nighttime leg cramps, but your healthcare professional will evaluate you, looking for possible causes and associated medical conditions based on your individual medical history.
How Can I Stop My Legs from Cramping at Night?
Some things you can do to stop leg cramps are: Get enough rest Stay well hydrated Do not over-exercising your muscles Do not sit or stand for too long in one position Massage and stretch your muscles regularly.
What Vitamin Helps Leg Cramps at Night?
Vitamin B complex supplements may help reduce the frequency, intensity, and duration of leg cramps. Vitamin D is also being studied, but there isn’t enough evidence yet to know if it’s effective.
K Health articles are all written and reviewed by MDs, PhDs, NPs, or PharmDs and are for informational purposes only. This information does not constitute and should not be relied on for professional medical advice. Always talk to your doctor about the risks and benefits of any treatment.

Zina Semenovskaya, MD

Dr. Semenovskaya specializes in emergency medicine, and received her medical degree from Weill Cornell Medical College. She is currently the medical director at Remote Emergency Medicine Consulting, LLC and splits her time working clinically as an emergency medicine attending in California and Alaska. She is the first of our doctors to be fluent in Russian.

Close button

Check your symptoms for free with K Health. If needed, chat with a doctor.

Start Now