treatment icon
treatment

Magnesium and Sleep: How This Essential Mineral Helps You Rest Better

Written by healthwords.ai's team of doctors and pharmacists based in UK | Updated: 18 Jun 2025 | 5 min read

Sleep is very important for good health, but many people have trouble sleeping well. There are lots of products that claim to help with sleep, but one natural option that is getting attention is magnesium. Magnesium is a mineral your body needs for many jobs, including helping you relax and sleep. But does magnesium really help you sleep better? Let’s look at what magnesium does, how it affects sleep, and how you can get more of it.

What is Magnesium?

Magnesium is a mineral that your body needs to work properly. It helps your muscles and nerves function, keeps your blood pressure normal, and supports your immune system. Magnesium also helps turn food into energy and helps your cells grow and repair.

For sleep, magnesium is important because it helps control chemicals in your brain called neurotransmitters. These chemicals send signals in your brain and nervous system. Magnesium helps keep the right amount of a calming neurotransmitter called GABA, which helps you relax and fall asleep.

You can find magnesium in foods like leafy green vegetables, nuts, seeds, and whole grains. Even though magnesium is in many foods, many people don’t get enough, which can make it harder to sleep.

How magnesium affects sleep

Calming the Nervous System

Magnesium helps calm your nervous system, making it easier to relax before bed. It does this by helping the brain use GABA, which quiets down brain activity. If you don’t have enough GABA, you may feel anxious or have trouble sleeping. Magnesium helps boost GABA, so your body can get ready for sleep.

Regulating Stress Hormones

Magnesium helps control cortisol, a hormone your body makes when you’re stressed. High cortisol levels, especially at night, can make it hard to fall or stay asleep. Taking magnesium may help lower cortisol, making it easier to relax and sleep.

Supporting Your Body Clock

Magnesium also helps your body make melatonin, the hormone that controls when you feel sleepy and when you wake up. If you have enough magnesium, your melatonin works better, helping you fall asleep and stay asleep.

Magnesium Deficiency and Sleep Problems

Many people don’t get enough magnesium from their diet. If you don’t have enough magnesium, you might have muscle cramps, feel restless, get anxious, or have trouble sleeping. Low magnesium can mess up your sleep patterns, make it hard to fall asleep, or cause you to wake up during the night.

Some people are more likely to be low in magnesium, like older adults, people with stomach problems (like Crohn’s disease or IBS), and people with type 2 diabetes. For these groups, getting more magnesium may help them sleep better.

Magnesium from food vs. supplements for sleep

Eating foods high in magnesium is a good way to get enough of this mineral. Here are some foods that are rich in magnesium:

  • Leafy greens: spinach, kale, Swiss chard

  • Nuts and seeds: almonds, pumpkin seeds, sunflower seeds

  • Whole grains: brown rice, quinoa, oats

  • Legumes: lentils, chickpeas, black beans

  • Fish: salmon, mackerel

The recommended daily amount of magnesium for adults in the US is about 400 mg for men and 300 mg for women.

If you don’t get enough magnesium from food, you can take supplements. There are different types of magnesium supplements:

  • Magnesium citrate: Easy for the body to absorb, good for people with constipation

  • Magnesium glycinate: Often used to help with sleep and anxiety, gentle on the stomach

  • Magnesium oxide: Has a lot of magnesium but is not absorbed as well, mostly used for constipation

  • Magnesium L-threonate: May help with brain function and possibly sleep, but more research is needed

Most supplements come in doses from 100 to 400 mg. Studies show that 200-400 mg can help improve sleep, especially for people with insomnia or low magnesium. Always follow the instructions on the label and talk to a doctor if you’re not sure how much to take.

Safety and Side Effects

Magnesium from food is safe, but too much from supplements can cause diarrhea, nausea, or stomach cramps. It's recommended not to take more than 400 mg of magnesium in supplements a day. If you take other medicines, check with your doctor first, because magnesium can affect how some medicines work.

Other health benefits of magnesium

Magnesium does more than just help you sleep. It also:

  • Relaxes your muscles and can help with cramps or restless legs at night

  • Supports a healthy heart and normal blood pressure

  • May help reduce anxiety and depression by calming the nervous system

  • Helps keep your bones strong by working with calcium

Practical Tips for Using Magnesium for Sleep

  • Take magnesium supplements 30 minutes to an hour before bed for best results.

  • Combine magnesium with good sleep habits, like having a bedtime routine, turning off screens, and doing relaxing activities before bed.

  • Try Epsom salt baths (magnesium sulfate) before bed to relax and absorb magnesium through your skin.

  • Eat magnesium-rich foods as snacks in the evening, like almonds or a spinach salad.

  • If you have side effects from supplements, try a different type or lower the dose.

When to see a doctor

If you have trouble sleeping for more than a few weeks and magnesium or other remedies aren’t helping, see your doctor. If you feel very tired during the day or have other symptoms like trouble breathing, severe anxiety, or depression, get medical help. A doctor can help find the cause of your sleep problems and suggest the right treatment.

Conclusion

Magnesium can help improve sleep by calming your nervous system, lowering stress hormones, and helping you relax. Eating magnesium-rich foods or taking supplements may help, but magnesium isn’t a cure for everyone. If you keep having trouble sleeping, talk to your doctor to rule out other health problems. Combining magnesium with healthy sleep habits gives you the best chance for a good night’s rest and better overall health.

This article has been written by UK-based doctors and pharmacists, so some advice may not apply to US users and some suggested treatments may not be available. For more information, please see our T&Cs.