Short answer: NIH says some ashwagandha preparations may help insomnia and stress, with unclear effects on anxiety.1 A review of 5 trials found a small sleep benefit.2 Magnesium's sleep evidence is thinner: a 2026 review rated it low to very low certainty and did not back it as a routine insomnia treatment.3 No trial has compared the two.
| Ashwagandha | Magnesium | |
|---|---|---|
| NIH view | Some preparations may help insomnia and stress; anxiety evidence unclear1 | The fact sheet sets an upper limit and safety notes; it does not cover sleep4 |
| Sleep | 5 trials (400 people): small overall benefit, larger with insomnia, 600 mg a day or more, and 8 weeks or longer2 | 12 trials: inconsistent results, low to very low certainty; 3 trials in 151 older adults: fell asleep 17 minutes faster35 |
| Stress and anxiety | 12 trials: lower anxiety and stress scores, low certainty; another review found lower cortisol but no change in perceived stress67 | 18 studies in people prone to anxiety: some positive results, poor-quality evidence8 |
| Side effects | Drowsiness, stomach upset, diarrhea, vomiting; rare liver injury1 | Diarrhea, nausea and cramping at high supplement doses4 |
| Limits and cautions | Short-term (up to 3 months) may be safe; avoid in pregnancy, breastfeeding, and with thyroid or autoimmune disorders1 | Upper limit 350 mg a day from supplements for adults4 |
| Head-to-head trial | None found | None found |
In a 2021 review of 5 ashwagandha extract trials in 400 adults, sleep improved by a small but significant amount, more so in people with insomnia. No serious side effects were reported, but the authors said long-term safety data are limited.2
For magnesium, a 2026 review of 12 randomized trials found results that disagreed across sleep diaries, sleep lab tests and wearables, rated the certainty low to very low, and said it does not support magnesium as a routine insomnia treatment.3 An earlier review of 3 small trials in older adults found people fell asleep about 17 minutes faster, with low-quality evidence.5
NCCIH lists rare liver injury with ashwagandha and says to avoid it in pregnancy and breastfeeding, before surgery, with autoimmune or thyroid disorders, and with hormone-sensitive prostate cancer. It may interact with diabetes, blood pressure, sedative, seizure, immune and thyroid medicines.1 Magnesium's main problem at high supplement doses is gut upset; very high doses can be toxic, and it interacts with some antibiotics and bone medicines.4
Ashwagandha has more trial support for sleep and stress, though the evidence is low certainty and long-term safety is unknown. Magnesium's sleep evidence is weak. They have not been tested against each other. This is general information, not personal advice. More detail: the Ashwagandha guide, Melatonin vs magnesium: which has better sleep evidence? and Magnesium citrate vs magnesium glycinate: which form?.