• Home
  • /
  • Blog
  • /
  • What Causes Leg Cramps at Night (and How to Prevent Them)

What Causes Leg Cramps at Night (and How to Prevent Them)

Leg cramps at night can be a literal pain in the a** (though they more commonly affect the muscles of the lower legs and feet). Unlike typical muscle cramps, they're usually NOT caused by dehydration, electrolyte imbalance, or even overuse. In most cases, there are several variables causing this sleep-interrupting nuisance.

In this article, we dive into what leg cramps at night mean, what causes them, and how you can prevent them according to studies in neurology, physiology, and our own clinical experience.

Key Points

1. Leg cramps at night (also called Nocturnal Leg Cramps) are caused by a multitude of factors including magnesium deficiency, disrupted Circadian Rhythm, damaged or overactive nerves, activity levels and stress.

2. Studies show magnesium supplementation alone is not effective for resolving nocturnal leg cramps.

3. To prevent and resolve nocturnal leg cramps you need to address underlying nutritional deficiencies, nerve health, and muscle dysfunction.
cramps in lower legs at night

Fig. 1: Lower Leg Anatomy: Nocturnal leg cramps typically affect muscles in the lower legs and feet, but can affect the upper thigh muscles as well. Leg cramps may also be accompanied by muscle cramps in the back, arms, and hands.

Doctors, neurologists, and physiologists have long been stumped by nighttime leg cramps.

Referred to as "Nocturnal Leg Cramps" this condition is exceedingly common in aging adults and athletes.

Studies show around 1/3 of adults aged 60 or more experience nocturnal leg cramps, and nearly one-half of those aged 80 years or more. Of those affected nearly 40% experience nighttime episodes several days per week.

Nocturnal leg cramps are characterized by episodes of painful, sudden, intense, involuntary contractions of muscles in the legs, feet and other extremities in the middle of the night.

Unlike typical muscle cramps, nocturnal leg cramps typically do not resolve naturally over time.

Typical Muscle Cramps vs. Leg Cramps at Night

Typical Muscle Cramps

Painful, intermittent episodes of muscle contractions

Often caused by physical exercise or unaccustomed vigorous exercise

Condition self-resolves over time

Symptoms onset during period of inactivity or extreme hyperactivity

Leg Cramps at Night

Painful, episodes of muscle contractions lasting up to a few minutes during the nighttime

Disturbs sleep patterns (Circadian Rhythm)

Results in lasting discomfort which may persist for several hours

Usually affect the thighs, calves and muscles of the feet

Condition does not self-resolve over time

Caused by nervous system malfunction & key nutrient deficiencies

Magnesium supplementation alone does not resolve symptoms

According to the esteemed, British Medical Journal (BMJ), a viable pharmacological option for nocturnal cramps “remains elusive.” Quinine is only moderately effective against nocturnal leg cramps, and there are significant concerns about its safety — leading most doctors to believe the risks outweigh the potential benefits.

Exercise therapy methods have yet to be examined in controlled studies.
And for nighttime cramps, magnesium therapy alone has proven to be ineffective.

This leaves those affected with no long-term, safe treatment options.

That is, until now. 

Recent studies crossing-over the categories of neurology, physiology, and sleep health show promise for finally conquering nocturnal leg cramps.

In this article, we cover:

  • why nocturnal leg cramps are caused by a completely different condition than typical muscle cramps
  • why magnesium supplements alone do not solve nocturnal leg cramps
  • what leading neuro-physiological studies show could be the cause and solution

Why Magnesium Supplementation Alone Doesn't Solve Nocturnal Leg Cramps

Recent estimates show that up to 80% of adults are deficient in magnesium.

This is due to several factors, including:

The alarming aspect of this statistic isn't the high percentage — it's that these figures are based on the minimal amount necessary to prevent disease!

That's right — the RDI (Referenced Daily Intake) figures you see on the backs of nutrition labels are only meant to ward off disease.  They aren't designed to facilitate optimal health, let alone improve it.

This means that virtually everyone would benefit from increasing magnesium intake.

Since whole food is clearly not sufficient, it makes sense to use a magnesium supplement.
But not all are created equal. 

And for those suffering from nocturnal cramps, a specific type of magnesium should be used, and it should be administered immediately before bed time
We'll come back to that in a minute.

Here are the common signs of a magnesium deficiency:

  • Muscle pain and cramps
  • Muscle weakness
  • Fatigue
  • Restlessness and sleep loss
  • Mood fluctuations and anxiety
  • Confusion and memory problems

If you suffer from nocturnal leg cramps, you almost certainly have a magnesium deficiency.
But that isn't the only cause.

People who suffer from nocturnal leg cramps have other key nutrient deficiencies and neuro-muscular dysfunctions.

That's why magnesium supplementation alone does not solve nocturnal cramping in clinical studies.

Nocturnal leg cramps are associated with five specific conditions that must be addressed.

People who suffer from nocturnal leg cramps have other key nutrient deficiencies and neuromuscular dysfunctions. This is why magnesium supplementation alone often does not resolve nocturnal leg cramps.

The Root Causes of Nocturnal Leg Cramps

There are five primary causes of nocturnal leg cramps.

These conditions are linked together, creating a positive feedback loop. This makes solving nocturnal leg cramps extremely difficult.

Here are the five most common, non-disease causes of nocturnal leg cramps:

1. Magnesium Deficiency

As we discussed, virtually anyone who suffers from persistent cramps has a magnesium deficiency.
So magnesium supplementation should be implemented.

Magnesium supplements demonstrated positive effects on cramps in studies (and in our experience working with exercise therapy clients).

But for nocturnal leg cramps, magnesium therapy alone has proven to be ineffective (reference: Family Practice, February 2014).

That's because people who suffer from nocturnal leg cramps have other key nutrient deficiencies and neuromuscular dysfunctions.

While magnesium is an important piece of the puzzle, it won't solve the problem by itself.

For nocturnal leg cramps, Magnesium Glycinate should be used immediately before bed.

Magnesium Glycinate is a combination of two separate compounds: the mineral Magnesium, and the amino acid Glycine.

Glycine has a natural calming effect, making it an ideal supplement to take before bedtime.

Unlike cheaper forms such as Magnesium Oxide, Magnesium Glycinate is readily absorbed into the intestinal walls. This prevents the "laxative effect" that many people experience when taking cheap magnesium supplements.

Muscle cramps can be brought by deficiencies of other minerals as well, including low potassium (hypokalemia) and low calcium (hypocalcemia). Though magnesium deficiency (hypomagnesemia) is the most common culprit both in studies and in our clinical observation.

2. Exercise & Movement Habits

The reason that leg cramps are often worst during the night is due to inactivity.

When you are still for long periods of time, neural activity and blood flow to extremities decreases. This can cause involuntary contractions of motor units (groups of nerves). When these motor units continue to fire persistently, it results in painful cramps and spasms.

Another reason that cramps persist is a malfunction of the inhibitory circuits responsible for relaxing muscles.

Because there are multiple points of possible malfunction along the muscle contraction-relaxation pathway, it's difficult to determine exactly where the fault occurs.

But in either case, the problem is caused by an underlying nerve malfunction, and exacerbated (brought to the point of symptoms) by periods of inactivity.

As you might have guessed, movement can help relieve and prevent cramps.

But how do you incorporate movement to prevent nighttime leg cramps?

Try doing reverse lunges immediately before crawling into bed to activate and stretch the primary muscles affected by nocturnal leg cramps.

You'll notice in the video below that this exercise stretches the calves on the descent, and mobilizes the quadriceps and hamstrings on each repetition.

Perform 10-15 repetitions per leg, or until you feel a good burn.
Stop before you get too exhausted to avoid ramping up your central nervous system (which could hinder sleep). The goal is to activate the muscle groups, not burn them out.

Both lack of exercise and overexertion can cause leg cramps at night.
Here are some other activity-related items that can cause (or at lease make worse) nocturnal leg cramps.

  • Sitting for long periods of time during the day
  • Over-exertion of the muscles (usually too high training volume in a relatively inexperienced athlete)
  • Poor posture
  • Tightness in low back, hamstrings, calves
  • Poor circulation in legs

Nocturnal Leg Cramps VS. Restless Legs Syndrome

Nocturnal Leg Cramps and Restless Legs Syndrome (RLS) are two of the most common causes of leg pain and discomfort. Because both occur at night, and some symptoms overlap, it can be difficult to distinguish between the two.

Restless Legs Syndrome is characterized by the urge to move the lower legs at night. So the key differentiator is cramping and pain.

Are you experiencing painful cramps?
If so, you're likely dealing with Nocturnal Leg Cramps.

Are you experiencing an urge to move, or an "electric" feeling in your legs, with minimal pain?
If so, you're likely experiencing RLS.

3. Overactive or Damaged Nerves

Another common cause of nocturnal leg cramps is overactive or damaged nerves.

Neuropathy is any disorder that prevents nerves from functioning properly.
There are two main types of neuropathy:

[1] Peripheral Neuropathy — characterized by multiple affected nerves, and/or problems with the connection between the Central Nervous System (brain and spinal cord) and Peripheral Nervous System (connections running from brain and spinal chord to the rest of the body).

[2] Mononeuropathy — damage to a single nerve or nerve group (motor unit), typically caused by trauma, injury, poor circulation, or inflammation.

Nocturnal leg cramps are more commonly related to mononeuropathy than peripheral neuropathy.

And the best way to resolve symptoms caused by mononeuropathy is to address the underlying causes. That means it helps to heal any lingering injuries to muscles or joints, take steps to improve circulation, and try to reduce levels of inflammation in the body.

Our friend magnesium can help here too. Studies show magnesium supplementation can help reduce nerve pain and overactive nerves by making muscles relax.

muscle cramps neuromuscular junction

Nocturnal leg cramps commonly originate from malfunctions in nerve cells or the neuromuscular junction—where the nerve cell intersects with muscle tissue.

When to seek medical attention

Though they may seem like a minor nuisance, leg cramps can be seriously debilitating. Schedule an appointment to see your doctor if your nighttime leg cramps:

  • lead to shooting pain, tingling or numbness
  • cause severe pain
  • were brought on by an injury or exposure to toxin
  • lead to muscle atrophy or muscle weakness (dark colored urine may be a sign of a serious muscular breakdown condition)

4. Disrupted Sleep Architecture (Circadian Rhythm)

Although we've made it clear magnesium supplementation is a must if you suffer with nocturnal leg cramps, studies show it doesn't solve night cramps on its own.

In order to solve nocturnal leg cramps, you have to re-establish a healthy sleep architecture
(i.e. your sleep habits and Circadian Rhythm).

Sometimes your body just needs a chance to sleep through the night so it can recover.

Focusing on sleep health — not just the cramps — is key.
And the longer you've been experiencing cramps at night, the more important this is.

Here are a few supplements proven to help improve your sleep architecture:

  • 1
    Vitamin B6 (Pyrodoxine)  is involved in over 100 biological processes in the body. Commonly known for its role in food metabolism and Serotonin production, B6 can be found in meats, fish, eggs, nuts and seeds — and is a common added ingredient to fortified cereals and grains.
    Studies have shown that poor sleepers have lower intake levels of Vitamin B6.

    Because B6 is a water soluble vitamin and is metabolized quickly, it should be taken immediately prior to bed.

  • 2
    GABA & 5-HTP are two amino acids that support relaxation and healthy sleep habits. Though these two amino acids are popular and proven supplements alone, an animal study published in Behavioral Brain Research (2016) demonstrated they have a synergistic effect on sleep quality and sleep cycle architecture when combined.
    Researchers from the study concluded:

    "Our available evidence suggests that the GABA/5-HTP mixture modulates both GABAergic and serotonergic signaling. Moreover, the sleep architecture can be controlled by the regulation of GABA receptor and GABA content with 5-HTP.”

  • 3
    Melatonin is a naturally occurring compound secreted by the pineal gland in the human body, commonly used in supplement form to reduce symptoms of “Jet Lag” and fall asleep faster.

    In clinical studies, melatonin supplements have clearly demonstrated positive effects on sleep quality (and interestingly enough, was also correlated with reduced body weight).
    For people with nocturnal leg cramps, melatonin supplementation can help re-establish their disrupted Circadian Rhythm.

5. Stress

Stress puts your body into a heightened state called hyperstimluation.
Also known as the Acute Stress Response — this reaction to stressors is useful in the short-term, but damaging when it becomes chronic.

When stress responses occur too frequently, your body can get stuck in a state of emergency readiness. 

This is called Stress-Response Hyperstimulation (SRH)

Several clients I've worked with have described having "cramp attacks," where they experience cramps, spasms, and pain in rapid and extended sequences. The cramps and spasms quite literally cause more cramps and spasms.

This is a snapshot of what Stress-Response Hyperstimulation can do.

To compound the situation, the stress hormones released in this state are potent stimulants (one of those being adrenaline).

Stimulants cause muscles to remain tense. Which leads to further muscle tension, muscle spasms, muscle cramps, headaches, and even increased magnesium excretion.

That's right. Stress actually increases the rate at which your body eliminates magnesium, worsening the original deficiency.

So you have a situation in which your body responds dramatically to pain or nerve malfunctions and gets stuck in the state of hyperstimulation. 

You can probably imagine the vicious cycle this stress-response system creates.

Stress is an underestimated factor in why nocturnal leg cramps are so persistent once they start.

Other Conditions Related to Leg Cramps at Night

There are a few other factors associated with nocturnal leg cramps. Though most of these describe muscle cramps in general, it's important to understand these and determine if any of these factors could be the partial cause of your symptoms:

  1. Dehydration and/or electrolyte imbalance
  2. Physiological Disorders: Pregnancy, flat feed, poor circulation, obesity
  3. Endocrine Disorders: Thyroid, Addison's Disease, HPA Axis Dysregulation
  4. Neuromuscular Disorders: Peripheral Neuropathy
  5. Venous Insufficiency (veins are unable to effectively send blood from legs to heart): other symptoms include leg weakness, leg pain, and general feelings of lethargy in legs.
  6. Anemia: Severe anemia can cause leg cramps during exercise.
  7. Alcohol, Drugs & Pharmaceuticals: Alcohol and certain pharmaceuticals have been linked to increase muscle cramping.

How to Stop Leg Cramps at Night

In order to win the battle against nighttime cramps, you need to accomplish three objectives:

  1. Correct key nutrient deficiencies (namely, magnesium).
  2. Re-establish a healthy sleep architecture (Circadian Rhythm) to prevent frequent waking throughout the night.
  3. Relax both muscles and the nervous system immediately prior to bed.

In our research, we identified 8 natural compounds that help relax tense muscles, reverse nutrient deficiencies, and improve sleep quality.

Since there is no viable pharmacological or exercise therapy treatment for leg cramps at night — and other magnesium or cramp supplements don't work for this condition — we assembled the world's first natural muscle relaxer specifically designed to reduce night leg cramps, spasms, and tension.

It's called Mag R&R

Mag R&R is manufactured in a GMP (Good Manufacturing Practices) approved, FDA-inspected facility right here in the USA. It's designed to be taken once per day, immediately before bed.

To test the formula's effectiveness before releasing to the public, we worked closely with our clients suffering from nocturnal leg cramps and took notes on their progress.

We were excited to launch Mag R&R and finally offer a solution to this annoying condition.

But we never could have predicted the overwhelming response from our clients — and people we’d never met who found our product online.

To read reviews from clients who have used Mag R&R, and learn more about this natural muscle relaxation formula, click the learn more button below.

Mag R&R Natural Muscle Relaxer for Leg Cramps and Pain, Sleep


Leg cramps at night are a nuisance. But they can also be a seriously debilitating problem, interrupting sleep and reducing overall quality of life.
And the longer you have them, the tougher it is to get rid of them.

The most common non-disease causes are magnesium deficiency, exercise & movement habits, nerve malfunction, stress, and disrupted sleep patterns.

Although magnesium supplementation can provide relief for most cases of muscle cramps, leg cramps at night require a more holistic approach. This includes reducing lifestyle stress, supplementing with key nutrients, getting enough exercise, and establishing healthy sleep habits.

After reading this article, what steps will you take to prevent and resolve nocturnal leg cramps?

Like this article? Please share it with your friends:


Author: Scott Hogan

Scott Hogan SaltWrap headshot

I created SaltWrap to bring together the most practical ideas in therapeutic sports nutrition, corrective exercise, and functional fitness — with the goal of keeping you (and myself) strong, mobile, and built to last.

I've worked as an A.C.E. Certified Personal Trainer, Orthopedic Exercise Specialist, and nutritional supplement formulator.

But more importantly — I've spent most of my life battling injuries, joint pain, and just being plain beat up. So I know what it's like to struggle toward fitness goals.

SaltWrap is here to push you through injuries, setbacks and perceived physical limitations. To a place beyond what you think you're capable of. Sign up here to stay in the loop.

Learn more about my best-selling injury prevention and recovery book, Built from Broken.

See full author profile

  • Thanks for stopping by! I hope you enjoyed this article. Let me know what you think in the comments below. Questions, opinions, and feedback are most welcome. I’m always interested in hearing what you all have to say.

    • Scott…I am 80 yrs old and VERY active… Coaching gymnastics two days a week …. Playing serious Pickleball 3 hours three day a week…. And am I in bicycle racing which involves training……. Cramps are never a problem during activity…….. Every night shins and calves and feet have a mind of their own…….. Just ordered your formula…… Looking forward to relief

      • Hi Dave – That’s impressive! I can only hope to be as active when I reach 80 years young 😀 >> I hope our formula works for you. If not, we have a money back guarantee. I check these comments regularly – but you’ll get an immediate response if you send us a message through saltwrap.com/contact.

        • Always like to read your columns s they are very interesting and informative.
          Been taking Mag r&r and it’s working well.
          I’d like to stay in touch.

          • Thank you for the feedback, Mich!!

  • Just started taking 3 Mag R&R, however I seem to be having disturbed sleep with all kind of dreams. Should I try taking less or possibly will my body eventually adjust to restful sleep?

    • Hi Mary – Sorry to hear you are having disturbed sleep.

      Though dreaming is a good thing, especially when you recall dreams, it’s not good when it interrupts your sleep. This is most likely from the ingredient GABA, which helps you spend more time in deep sleep and creates more vivid dreams. I suggest taking 1 capsule per night for one week, then upping the dose to two capsules for one week. If you are not getting the relief you are seeking at that point, then increase it again to the full 3 capsules. This should give your body time to adjust to the formula, and provide the relief you’re looking for. Many people are able to get relief with only 1-2 capsules. The full serving of 3 capsules is strong!

  • I am 76 years old and have had very frequent feet, leg and thigh cramps for many years. The thigh cramps are especially painful. I began taking a magnesium supplement and it did help me but I continued to have cramps but less often. I also have trouble sleeping even though I was taking Melatonin. I recently bought my first bottle of MAG R&R and so far I feel it is helping me. I am sleeping better and have had no more cramps.

    • Great to hear! The thigh cramps ARE painful. I didn’t mention this in the article, but I experienced them during a period when I was magnesium deficient. Hopefully they stay away from you from now on. Thanks for letting us know Mary

    • Richard Kelly says:

      Hi Mary, I am 91 and was having nocturnal cramps for a few years and got my first bottle of Mag R & R just after Christmas last year and take one capsule before bedtime and I haven’t had any cramps since I started so great product, I know every one is different but I hope it does as well for you as it has for me.

  • Just ordered my first bottle. Hope it works. I do have MS so that could be a negative on my results.With MS one never can be sure if the problem stems from that disease or from lack of certain nutrients.Fingers crossed as to how much it helps.I will let you know.

  • Rachel Hembrough says:

    I am so grateful! Finally! I don’t have to dread my nights any longer ! I am an ultrasound technologist in a busy ER , I work 12-14 hour long days. On the days that I worked, my nights were hell- jumping up all night because of these horrible Charlie horses is my legs, feet. I just couldn’t get rest after working so hard all day. Now I do and I just want to thank you . I can’t live without this stuff! I go all night now with no leg cramps! Thank you so much! xoxo

      • Hello Scott, I stumbled across this website trying to find and figure out what is going on with my cramps. Have been to Nero surgeon, neurologist etc. MRI. This has been 3 1/2 yrs. Have all kinds of pharm meds/ mag vitamins and to no prevail nothing works. I have even thought about amputation. I can’t live like this. I have ordered one bottle to try !!! I am thinking the damaged is done and will not get any relief from reading your article. I pray this works. Please advise and or help me get through this ordeal. Thank you for your time and help. Jana Shap.

        • Hi Jana – I’m really sorry to hear that. First, let me say that I am not qualified to make any recommendations for you personally. Definitely see your doctor, I can’t imagine amputation is your best option. I hope you can get some relief. It sounds like there may be an underlying condition that needs addressed.

  • Can you crush this and take with something if you have swallowing problems?

    • Hi Gail! It’s a capsule, so you can twist it in half and pour the powdered contents into liquid. It has an earthy taste, but its not that bad. Several of our customers do this.

  • These work for my husband!! He has a strenuous physical job. His diet was not the best but getting better. Drinking more water. We tried all this, taking magnesium potassium, diet, water, pickle juice. He had cramps so bad n crying but after taking this none unless he has caffeine which he had to cut out completely. I would like to know if he will ever have muscle recovery n doesn’t have to take these anymore or how long it will take?

    • Hi Linda! That’s great to hear! We have heard reports of people resolving their cramps/tension issues, then eventually weaning off of supplements and other therapeutic interventions. This could be the case if a nutrient deficiency is one of the root causes. I would caution you to wean off slowly rather than going cold turkey 🙂

      • Wilton W Kullenberg says:

        Caffine is to hard for me to Stop

        • It’s hard for all of us, Wilton.

  • Theresa Vargas says:

    Hi I’m Theresa I’m 57 years old and I have had these cramps for to long but I’m using Mag RR I’m trying this and so it’s amazing because I really haven’t had cramps since I have never used anything like it.

  • Wilton Kullenberg Jrwkullenberg@yahoo.com says:

    I am a active person. can’t stop moving my Body! 67 years young. I have been taking Mag R&R For about two weeks?

  • What does it mean a dark urine? Will this help with that are is there another problem I have? I have leg and feet cramps regularly maybe not every night but more than not. I am very interested in this product. Thanks

    • Hi Dawn – Please check with your physician on that. Thanks for reading the article!

  • How many tablets should I take…I am 58 years old female and I weigh 130lbs

    • Hi Rose! Start with 1 capsule to assess tolerance, and work up to 3 as necessary (to get desired effects). 🙂

  • Richard Kelly says:

    I was having 4 Of 5 cramps at night for a few years so I ordered a bottle of Mag r and r and took one capsules before bedtime and no cramps! I have continued this since last December 28th until now, however my cramps have started to reoccur just in the last couple of days, any suggestions on why this is happening.

    • That’s great to hear, Richard! It’s not uncommon for symptoms to pop up every now and again on your path to completely preventing them. However, over the course of a few weeks you should be seeing steady progress.
      If not, reach out to us via email and we’ll figure out how to help you.

  • I can’t thank you enough, I was sleeping 30 minutes at a time every night before I opened an email about Mag R&R. I was having nightly nocturnal leg cramps for a year; doctors had no good advice. I ordered a bottle and have had 1 cramp 1 night since starting it. I will never be without it. I have tried so many other things that were a waste of money. I have taken the bottle to doctor appointments my primary doctor took all the information down to pass along to other patients, since he had it on good authority that it works.

    • That is wonderful! Thank you for sharing your story, Sue. 😀

  • I like that you get to the point and don’t go on and on . Clear, concise, get the message across. Thank you. Cindie Thompson

    • Thanks for the feedback, Cindie! I’m happy you got value from the article 😀

  • Scott,
    Skimmed through but very informative with even skimming through.
    Lord willing hope to read through more thoroughly soon.
    Will share with family, friends and social media.
    Seemed deeper then most articles I have read on the subject. Yet still not over the top so that the every day person can understand it.
    Thanks and keep it up.

      • Rick l winkel says:

        Could not fall asleep all night, did stop the leg cramps though
        Any suggestions ?

        • Hi Rick! Glad to hear the cramps stopped! But we also want to see you sleeping through the night. First and foremost, stick with — consistency is key and studies show the best results accumulate after 30-60 days of continued use. Also, I recommend looking into your bedtime routine, hydration, and caffeine usage to determine if there are any other opportunities to improve your nightly pre-bed routine.

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}