Melatonin: a timing signal, not a sleeping pill
Melatonin gets reached for as a general sleep aid more than almost any other supplement, and for that job it's usually the wrong tool. Not a dangerous one — just aimed at a different target than people think.
What melatonin actually does
Melatonin is a hormone your brain produces in response to darkness, and its role is timing your circadian rhythms rather than sedating you the way a sleep medication does. It tells your body what time it is. It doesn't switch your brain off.
That distinction predicts where it works. For jet lag it is well supported: a Cochrane review concluded melatonin is effective at preventing or reducing jet lag and recommended it for adults crossing five or more time zones, particularly flying east. Shift work and delayed sleep phase are the same category of problem: clock misalignment.
What the evidence actually supports for insomnia
Much less. NCCIH summarizes both the American Academy of Sleep Medicine and American College of Physicians guidelines as finding not enough strong evidence to recommend melatonin for chronic insomnia — and the ACP strongly recommends cognitive behavioral therapy for insomnia (CBT-I) as the first-line treatment instead.
That's the honest ceiling. If your problem is a brain that won't stop at midnight, melatonin isn't the lever — CBT-I is the one with a guideline behind it.
The dose and label problem
Melatonin is regulated as a supplement, not a drug, and the quality control shows it. In a 2017 analysis cited by NCCIH, most products tested didn't match their label, and 26% contained serotonin as a contaminant.
Dose is the other half of the problem. The circadian research generally uses 0.5 to 3 mg, close to what your brain actually produces, because higher doses don't shift timing proportionally harder. Most of what's on the shelf is 5 to 10 mg, not more effective for timing, and more likely to leave you groggy or wired-but-tired the next morning. NCCIH is direct that for amounts higher than the body produces, there isn't enough information to characterize safety.
What to actually do
Use melatonin for the job it's built for: a clock that's in the wrong time zone. For ordinary trouble falling or staying asleep, ask about CBT-I, and treat persistent insomnia as a symptom worth working up. Magnesium insufficiency and thyroid dysfunction both belong on that list: a systematic review of thyroid function and sleep concluded the link between hypothyroidism and insomnia likely runs in both directions. The connection goes deeper than most people assume — TSH even regulates the enzymes that make melatonin in thyroid tissue. That is bench science, not a dosing instruction, but a fair prompt to get thyroid checked.