Melatonin vs Magnesium: what to choose and for whom
When a person says «I sleep badly», completely different causes may lie behind this: a disrupted schedule, flights, evening training, muscle cramps or simply coffee at six in the evening. Melatonin and magnesium help in different ones of these situations. The editorial team breaks down for whom and when it is more logical to choose each of the remedies, and when neither is suitable.
Three questions before choosing
The first question is whether the problem is in the timing of sleep. If you can sleep well but the body «wants» to fall asleep much later than the schedule requires, or you have just flown across several time zones, this is about the circadian rhythm. Here melatonin works.
The second question is whether there are signs of a magnesium shortfall. A monotonous diet with little vegetables, nuts and whole grains, intense training with profuse sweating, muscle cramps and twitching make magnesium the more logical candidate.
The third question is whether there is an obvious external cause. Caffeine in the second half of the day, alcohol, bright screens before bed, an irregular schedule and anxiety often explain poor sleep better than any deficiency.
If the answers are not obvious, it is reasonable to start with a two-week sleep diary: bedtime, falling asleep, waking, coffee, training. Such simple recording often itself suggests the right choice.
For whom melatonin is more logical
For travelers and athletes who often fly to competitions. The Cochrane review showed that melatonin reduces the manifestations of jet lag; doses from 0.5 to 5 mg in studies gave similar benefit, and a higher dose promoted faster falling asleep.
For people with delayed sleep phase — those who for years cannot fall asleep before deep night. Clinical guidelines on circadian disorders support properly timed melatonin intake, usually in combination with a lighting schedule.
For shift workers melatonin sometimes helps to fall asleep during the day after a night shift, although the data here is less convincing, and darkening the room and a stable schedule remain more important.
For people aged 55 and over with insomnia, in the EU prolonged-release melatonin 2 mg may be prescribed. The decision in that case is made by a doctor taking into account other medications and diseases.

For whom magnesium is more logical
For people with a diet poor in vegetables, legumes, nuts and whole grains. For them magnesium is not a «sleeping pill» but a correction of a basic shortfall from which sleep, well-being and recovery after training can all suffer.
For athletes with a high volume of load and profuse sweating, in whom the need for magnesium may be higher. For this group forms with a gentle effect on the intestines, such as glycinate, are convenient.
For people who complain of muscle tension and nighttime cramps. However, it is worth knowing that there are many causes of cramps, and in people without a magnesium deficiency its effectiveness for cramps is doubtful. If cramps are frequent, examination is needed.
For those for whom melatonin is not suitable: people with autoimmune diseases, those taking interacting medications, or those in whom melatonin causes a morning «heaviness» or vivid dreams.
Choice table by situation
We have gathered the most typical situations in one table. It helps to get oriented but does not replace a doctor's consultation.
| Situation | Remedy | What to pay attention to |
|---|---|---|
| Eastward flight across 5+ time zones | Melatonin | Intake at bedtime by local time |
| Cannot fall asleep until 2–3 a.m. for years | Melatonin with a doctor | Critical time of intake and light schedule |
| Little vegetables and nuts, fatigue, cramps | Magnesium | A gentle-acting form, up to 350 mg from supplements |
| Late training, hard to «switch off» | First the schedule; magnesium as a supplement | Cool-down, cool room, no caffeine |
| Kidney disease | Magnesium only by prescription | Risk of accumulation |
| Insomnia over 3 months | Doctor | CBT-I — first line |
These remedies can also be combined: there are no known dangerous interactions between them, and in the study by Rondanelli et al. (2011) the combination was studied in older people. However, it is better to start with one remedy to understand what exactly works.
Practical cautions
Melatonin is not an ordinary «vitamin» supplement. In many EU countries certain forms are sold by prescription, and it is not recommended to take it without a doctor for pregnant women, children, people with epilepsy and autoimmune diseases, as well as those taking anticoagulants or fluvoxamine.
Magnesium is generally safe for healthy people, but in doses over 350 mg from supplements it often loosens the stool. In kidney disease it can accumulate, so in that case a doctor's supervision is needed.
- After taking melatonin do not get behind the wheel if you feel drowsy.
- Space out in time magnesium and tetracycline or fluoroquinolone antibiotics.
- Athletes should choose products with independent certification for the absence of banned substances.
- Assess the effect honestly: if there are no changes in 2–4 weeks, there is no sense in continuing intake.
For athletes sleep is a key element of recovery, and reviews on this topic emphasize that behavioral measures — a regular schedule, control of light, caffeine and evening loads — give the greatest and safest effect.
Editorial conclusions
Melatonin is logical when sleep timing is disrupted: flights, phase delay, shift work. Magnesium — when there are signs of a mineral shortfall or an increased need due to training and diet.
Neither remedy replaces sleep hygiene or treats chronic insomnia, for which the first line is cognitive behavioral therapy.
Melatonin and magnesium can be combined, but it is better to introduce them sequentially, assessing the effect of each.
The editorial team also recommends articles on melatonin and glycine, on 5-HTP and melatonin and on the comparison of magnesium and ZMA.
References
- Herxheimer A, Petrie KJ. Melatonin for the prevention and treatment of jet lag. Cochrane Database Syst Rev. 2002;(2):CD001520.
- Auger RR, Burgess HJ, Emens JS, Deriy LV, Thomas SM, Sharkey KM. Clinical practice guideline for the treatment of intrinsic circadian rhythm sleep-wake disorders. J Clin Sleep Med. 2015;11(10):1199–1236.
- Sateia MJ, Buysse DJ, Krystal AD, Neubauer DN, Heald JE. Clinical practice guideline for the pharmacologic treatment of chronic insomnia in adults: an American Academy of Sleep Medicine clinical practice guideline. J Clin Sleep Med. 2017;13(2):307–349.
- Rondanelli M, Opizzi A, Monteferrario F, Antoniello N, Manni R, Klersy C. The effect of melatonin, magnesium, and zinc on primary insomnia in long-term care facility residents in Italy: a double-blind, placebo-controlled clinical trial. J Am Geriatr Soc. 2011;59(1).
- Institute of Medicine. Dietary Reference Intakes for Calcium, Phosphorus, Magnesium, Vitamin D, and Fluoride. Washington, DC: National Academy Press; 1997.
- Halson SL. Sleep in elite athletes and nutritional interventions to enhance sleep. Sports Med. 2014;44(Suppl 1):S13–S23.
- Mah J, Pitre T. Oral magnesium supplementation for insomnia in older adults: a systematic review & meta-analysis. BMC Complement Med Ther. 2021;21(1):125.
Andriy Melnyk
A strength-sports coach and author of programs for beginner and intermediate levels. Writes about training planning.


