RISE Sleep Tracker
One of Apple's Best Apps of 2024

When to Take Magnesium for Sleep? Sleep MD Answers

The best time to take magnesium for sleep may be 30 minutes—1 hour before bed. Timing may not make a difference, so you can take it earlier if you prefer.
Written by
Jeff Kahn, M.S., Rise Science Co-Founder
Reviewed by
Chester Wu, MD, Rise Science Medical Reviewer
Our Editorial Standards
We bring sleep research out of the lab and into your life. Every post begins with peer-reviewed studies — not third-party sources — to make sure we only share advice that can be defended to a room full of sleep scientists.
Learn more
Updated Regularly
We regularly update our articles to explain the latest research and shifts in scientific consensus in a simple and actionable way.
Woman taking magnesium supplement for sleep

When Should I Take Magnesium for Sleep?

  • Dr. Chester Wu, sleep specialist and RISE sleep advisor, recommends taking magnesium about 30 minutes to one hour before bed. 
  • Timing may not make that much of a difference, though, and magnesium doesn’t make you sleepy straight away, so you can take magnesium in the morning or earlier in the day if you prefer. 
  • The RISE app can help you remember to take magnesium as part of your wind-down routine before bed. RISE can also guide you through the daily habits that can help you fall and stay asleep without any supplements at all, so you don’t have to worry about magnesium timing.

Timing is everything when it comes to many medications, but more research is needed to find the best time to take magnesium for sleep. 

Magnesium doesn’t make you sleepy straight away, so you may be able to take it at any time of day. Many experts, including RISE sleep advisor Dr. Wu, recommend taking it about 30 minutes to one hour before bed, though. 

Below, we’ll dive into the best time to take magnesium for sleep, when it’s appropriate and not appropriate to take it, and how the RISE app can help you take magnesium at the right time or fall asleep without popping a pill to begin with.

Advice From a Sleep Doctor

Advice From a Sleep Doctor

“I usually recommend people take magnesium supplements about 30 minutes to one hour before bed as part of a wind-down routine,” says Dr. Chester Wu, Rise Science sleep advisor, medical reviewer, and double board-certified doctor in psychiatry and sleep medicine.

“But the time of day may not make a difference to how effective magnesium supplements are for sleep, so if you prefer to take them in the morning or earlier in the day, that’s fine.”

What’s the Best Time to Take Magnesium for Sleep? 

Dr. Wu recommends taking magnesium about 30 minutes to one hour before you go to bed as part of your nightly wind-down routine. But there’s no one best time to take magnesium for sleep.

The best time to take magnesium may depend on:

  • The form of magnesium you take
  • The amount of magnesium you take
  • Your own reaction to the supplement
  • What you’re taking magnesium for (eg. for insomnia or restless leg syndrome)
  • If you’re on medication (you may need to space out magnesium and other drugs)

Check the guidance given by the supplement you’re taking and speak with a healthcare provider to see if there’s a best time for you. 

You can take magnesium during the day as the supplement won’t sedate you. Sometimes guidance provided by the supplement maker advises spacing out your dose throughout the day. 

Instead, magnesium works by:

  • Promoting muscle relaxation
  • Increasing gamma-aminobutyric acid (GABA), a neurotransmitter that lowers anxiety
  • Increasing the sleep hormone melatonin
  • Decreasing the stress hormone cortisol
  • Playing a role in regulating your circadian rhythm, the internal clock that helps to control your sleep cycle

This may help you fall asleep faster and get more sleep overall, but you won’t feel the effects of magnesium straight away.

More research is needed to find the most effective time to take magnesium supplements. Different timings haven’t been compared to find out which is most effective or if they make a difference. Many studies on magnesium and sleep don’t share when a magnesium supplement was taken, or participants take multiple supplements across the day. 

Studies are also done in controlled environments, under medical supervision, and on specific populations, so timings can’t necessarily be taken as guidelines for the general population. 

Saying that, studies typically instruct participants to take magnesium two hours or less before bed:

  • A 2019 study on people with insomnia found that taking a magnesium, melatonin, and vitamin B complex supplement for three months one hour before bed led to an improvement in insomnia. 
  • A 2024 study — which is currently undergoing review — on people with nonclinical insomnia symptoms found taking magnesium two hours or less before bed led to improved sleep metrics measured by questionnaires and an Oura Ring, including sleep duration, deep sleep, and sleep efficiency (the percentage of sleep time after going to bed). 

So, it’s still unclear if timing plays a role in how effective magnesium supplements are. It may be more important to take them consistently — at any time of day — to increase your magnesium levels. 

In this case, choose a time that you’ll most likely remember to take the supplement — whether that’s first thing with breakfast or as you’re winding down for bed. 

If you decide to take it before bed, RISE can send you a notification when it’s time to start your wind-down routine, which you can use as a reminder to take magnesium. Get this notification on your phone, iPad, or Apple Watch, and customize when you’ll be reminded. 

RISE app screenshot reminding you of your wind-down activities
RISE can remind you when to take magnesium supplements as part of a wind-down routine.

Should I Take Magnesium in the Morning or at Night? 

You can take magnesium in the morning or at night. It may not make that much of a difference and taking magnesium in the morning shouldn’t make you tired during the day. 

We’ve covered more on whether magnesium can make you tired here. 

Should I Take Magnesium Before or After Food? 

You can take magnesium either before or after food. It may not make a difference to how effective it is. 

Taking your supplement with a meal may help reduce potential digestive side effects.

Magnesium side effects include: 

These side effects can come from taking too much magnesium (the Office of Dietary Supplements at the National Institutes of Health says the tolerable upper limit to avoid side effects is 350 mg), so you may not experience them if you’re taking the right amount. 

Learn more about how much magnesium to take for sleep here. 

{{ cta }}

How Long Does It Take Magnesium to Work for Sleep? 

It may take a few days or weeks for you to notice the effects of magnesium supplementation on your sleep. But there are no universal guidelines for how long it takes magnesium to work for sleep. 

It may depend on the amount and type of magnesium you take, your health status, and what you’re taking magnesium for. Dr. Wu usually advises his patients to continue taking magnesium for up to two to three months before expecting any changes and to stop taking supplements if they don’t see an improvement in their sleep. 

Speak to a doctor to find out when you can expect magnesium to make a difference to your sleep. 

Studies on the supplement vary in length (from weeks to months) and because how long it takes for magnesium supplementation to work isn’t studied, it’s unclear from research if supplements started working before the end of the studies. It’s also unclear how long you’d have to take magnesium to keep these benefits. 

One rare example where the time it takes magnesium to work was studied is a 2023 study on people with restless leg syndrome. It found that taking magnesium daily for two months reduced symptoms and improved sleep. There wasn’t much difference after just one month of supplementation.

It’s also not guaranteed that magnesium will improve your sleep at all. Most magnesium research includes people with a magnesium deficiency, a health condition, or a sleep disorder, or it’s on older adults.

Plus, most studies are small, low quality, use different doses and types of magnesium, and have inconsistent findings. 

When Should You Take Magnesium for Sleep? 

You don’t have to take magnesium to get a good night’s sleep. It can be useful in some cases, such as if you have: 

  • Insomnia
  • Restless leg syndrome
  • Anxiety
  • Depression 
  • A magnesium deficiency (which may be contributing to the conditions above)

Beyond sleep, magnesium has other health benefits, such as improving: 

  • Constipation 
  • Migraines 
  • Hot flashes
  • Muscle and leg cramps for some
  • Blood pressure 
  • Type 2 diabetes 
  • Heart disease
  • Osteoporosis 

You may benefit from magnesium supplements if these issues keep you up at night. More research is needed to know if magnesium can help everyone in these cases, or help people without these issues get better sleep.  

If you’re considering magnesium, speak to a healthcare provider to find out if it’s safe for you or a registered dietitian to find out if you have low levels of magnesium. 

And if you’re in the market for a sleep supplement, we’ve covered magnesium vs. melatonin here. 

Expert tip: If you’re struggling to sleep, there’s something else to consider before magnesium: sleep hygiene. Sleep hygiene are the daily habits that impact your sleep. Improving your sleep hygiene can help you fall asleep faster and stay asleep through the night. 

You might find when you improve your sleep hygiene, you don’t need magnesium — or any other sleep aid.

Good sleep hygiene includes: 

  • Going to bed and waking up at the same times each day 
  • Getting bright light first thing each morning
  • Avoiding bright light about 90 minutes before bed
  • Avoiding caffeine, large meals, alcohol, and vigorous workouts too close to bedtime   
  • Making sure you’re bedroom is cool, dark, and quiet 

To stay on top of it all, RISE can tell you when to do 20+ sleep hygiene habits at the right time for your body. 

RISE app screenshot showing sleep hygiene habit reminders
RISE guides you through 20+ sleep hygiene habits.

RISE users on iOS 1.202 and above can set up their 20+ in-app habit notifications here

Heads-up: As well as making good sleep hygiene a habit, good sleep starts with knowing how much sleep you need. This is determined by genetics and known as your sleep need. It can vary quite a bit from person to person. For example, among 1.95 million RISE users, sleep needs range from five hours all the way to 11 hours 30 minutes. 

RISE can work out your personal sleep need.

The RISE app can tell you how much sleep you need
RISE users’ sleep needs.

RISE users on iOS 1.202 and above can view their sleep need here.  

What Type of Magnesium Is Best for Sleeping? 

Dr. Wu usually recommends magnesium oxide, magnesium citrate, or magnesium glycinate for sleep.

Many experts recommend magnesium glycinate and magnesium L-threonate as they're easy for the body to absorb and may have calming effects. Many studies on the benefits of magnesium use magnesium oxide, which though less readily absorbed, can help maintain sufficient magnesium levels in the body, or magnesium citrate, which can relax muscles and the nervous system. More research is needed to find the best type of magnesium for sleep.

Types of magnesium supplements include: 

  • Magnesium glycinate
  • Magnesium citrate
  • Magnesium oxide
  • Magnesium chloride
  • Magnesium sulfate
  • Magnesium lactate
  • Magnesium aspartate 
  • Magnesium L-threonate

According to the Office of Dietary Supplements at the National Institutes of Health (NIH), magnesium aspartate, magnesium citrate, magnesium lactate, and magnesium chloride are absorbed more completely and are more bioavailable (a larger amount enters your circulation) than magnesium oxide and magnesium sulfate.

Check with a doctor to find out the best type for you.   

We cover if magnesium is good for energy here.

{{ cta-mini }}

Can You Take Magnesium Every Night? 

According to Dr. Wu, most people can take magnesium every night. Check with a healthcare provider to make sure it’s safe for you and stick to a maximum of 350 mg a night to avoid side effects (unless advised otherwise). More research is needed on long-term magnesium use.

If you have ongoing sleep problems, consider speaking to your healthcare provider or a sleep specialist to solve the root cause instead of relying on magnesium every night. 

When Should You Avoid Taking Magnesium? 

You should avoid taking magnesium if you have a health condition — like kidney disease or heart disease — if you’re on medication, or if you’re pregnant or breastfeeding. You may be able to take magnesium, but speak to your doctor first to make sure it’s safe for you. 

Magnesium can interact with medications like: 

  • Bisphosphonates 
  • Antibiotics
  • Diuretics 
  • Proton pump inhibitors 

You may have to wait a few hours after taking medication before you take magnesium. 

You should also avoid taking magnesium if it causes ongoing side effects or side effects that impact your sleep — like nausea, cramping, and diarrhea.

And if you have a sleep disorder, consider speaking with a sleep specialist before taking magnesium. They can recommend the best dosage or whether other treatments would be more effective. 

You may not need any supplemental magnesium if you’re already getting enough magnesium from your diet. Magnesium intake from food sources may be better for your sleep than magnesium in supplement form anyway. 

Magnesium-rich foods include: 

  • Leafy green vegetables like spinach 
  • Legumes like lentils and beans 
  • Nuts like cashews 
  • Seeds like pumpkin seeds and chia seeds  
  • Whole grains
  • Fortified breakfast cereals 

Best Magnesium Timing: The Bottom Line 

Magnesium is an essential mineral and taking it in supplement form may improve your sleep. But more research is needed to find the best time to take magnesium. Dr. Wu recommends taking magnesium about 30 minutes to one hour before bed, but timing may not make that much of a difference. 

If you want to make taking a magnesium supplement a habit, take it as part of your wind-down routine before bed. RISE can send you a reminder when it’s time to do your evening routine. 

If you don’t want to worry about magnesium timing at all, RISE can help you fall asleep without any supplements by guiding you through 20+ sleep hygiene habits that are proven to help you fall and stay asleep. 

Users notice the difference: 

“I’m sleeping better regardless of time asleep (we all know life happens) because RISE will give me notifications about when to stop drinking coffee and alcohol, and when my ideal time to go to bed is.” Read the review.

And it can work faster than magnesium supplements — 80% of RISE users get more sleep within five days. 


Sleep better. Sell more.

Learn more about Rise for sales teams.

Thanks! We received your information. You'll hear from us shortly.
Oops! Something went wrong while submitting the form.
About Rise
Rise is the only app that unlocks the real-world benefits of better sleep.

Instead of just promising a better night, we use 100 years of sleep science to help you pay down sleep debt and take advantage of your circadian rhythm to be your best.

Over the past decade, we've helped professional athletes, startups, and Fortune 500s improve their sleep to measurably win more in the real-world scenarios that matter most.

Rise Science is backed by True Ventures, Freestyle Capital, and High Alpha; investors behind category winners Fitbit, Peloton, and Salesforce Marketing Cloud.

Sleep Hygiene

View all
Try 7 days free

The power behind your next best day

RISE makes it easy to improve your sleep and daily energy to reach your potential

RISE app iconApp store icon