Medication & supplements

Melatonin: the hormone people take for sleep, and what it actually does

By Angus Munro, Clinical Psychologist (AHPRA PSY0001626434) · Last clinically reviewed 2026-07-10 · 9 min read

Melatonin is the hormone your brain releases as darkness falls, a quiet internal signal that night has arrived. When people take melatonin as a hormone for sleep, they are trying to borrow that signal in a tablet or a gummy and hoping it will switch sleep on. But melatonin is a timing cue, not a sedative, and for the persistent, wired-at-2am kind of insomnia most people are actually fighting, that one distinction changes almost everything.

I want to be upfront. This is not an anti-medication piece, and it is not medical advice for your particular situation. It is an honest map of what melatonin and the common sleep drugs actually do, so you can have a better conversation with whoever prescribes for you, and so you stop aiming a timing tool at an arousal problem.

How melatonin actually works

Deep in the brain sits the pineal gland. As light fades in the evening, it starts releasing melatonin into the bloodstream, levels climb through the night, and they fall again towards morning. That rhythm is one of the main ways your body keeps track of day and night. Melatonin is less an off-switch for the brain and more a messenger that says, it's night now.

This is why melatonin is tied so closely to your circadian rhythm, the roughly 24-hour clock that governs when you feel sleepy and when you feel alert, and why people reach for it around jet lag or night shifts, when the clock itself is out of step. Whatever it can do, it does by nudging timing, not by sedating a busy mind.

So notice what that means. Melatonin tells your body when it is night. It does not make a racing, vigilant brain go quiet. If you are lying awake because your system is switched on, not because your clock thinks it's noon, you are treating the wrong variable.

Does melatonin help with insomnia?

Here is where the evidence gets uncomfortable for a product this popular. The American Academy of Sleep Medicine, in its clinical guideline on medications for chronic insomnia, recommends against melatonin for chronic insomnia, on the grounds that the quality of the evidence is low and any benefit over placebo is small (Sateia et al., 2017). That is a treatment guideline, a careful reading of the whole body of trials, not one stray study.

Read that carefully, because it is easy to over-read. It does not say melatonin is dangerous, or that it never helps a single person. It says that for the ongoing, night-after-night insomnia most people mean when they use the word, melatonin is not a reliable answer.

The gummy version marketed for sleep does not change that verdict. A pleasant flavour and a "for sleeping" label are marketing, not mechanism. Whatever melatonin can and can't do, it does much the same whether it arrives as a tablet, a liquid, or a gummy. If you do use one, the amount and the timing are worth a quick word with a pharmacist or your prescriber rather than guesswork.

What about antihistamines like diphenhydramine?

When melatonin doesn't work, a lot of people reach for the other thing on the same shelf: an over-the-counter sleep aid, usually a sedating antihistamine such as diphenhydramine. It does make you drowsy. Drowsy is not the same as good sleep.

The same guideline recommends against diphenhydramine for chronic insomnia as well (Sateia et al., 2017). And the diphenhydramine side effects are worth knowing before you lean on it: next-day grogginess, a dry mouth, blurred vision, and the broader anticholinergic load that makes this class a poor fit for older adults in particular. In the wider evidence on sedatives in people over 60, the benefit to sleep was small while cognitive and psychomotor side effects rose roughly two- to four-fold (Glass et al., 2005). A drug that fogs tomorrow to blur tonight is a poor trade for most people.

Prescription options: doxepin, zolpidem and the z-drugs

If you and your doctor move into prescription territory, it helps to know these medicines are not magic, and that the guidelines treat them cautiously.

Doxepin is an older antidepressant that, at the low doses used at night, acts mainly as a sedating antihistamine. Whether you have seen it written up as doxepin for sleep or doxepin for insomnia, it is the same idea: a sedating agent that the guideline gives only a weak, conditional recommendation to, because the evidence is limited and the effect modest (Sateia et al., 2017).

The z-drugs, zolpidem chief among them, are the other common route. Zolpidem for sleep does shorten how long it takes to drift off, but by less than the marketing implies. In the trial data submitted to the FDA, z-drugs cut measured time-to-sleep by roughly 22 minutes on average, and a large share of even that was a placebo response (Huedo-Medina et al., 2012). A more recent network meta-analysis of 154 trials placed zolpidem's balance of benefit and tolerability below some newer agents, and found almost no dependable long-term data for any of them (De Crescenzo et al., 2022).

There is also the question of time. The European insomnia guideline names the behavioural treatment, not a drug, as first-line, and advises that z-drugs and benzodiazepines be used only when that isn't working, and then generally for no more than about four weeks, because tolerance can build within days to weeks (Riemann et al., 2023). These are short-term tools by design.

One plain safety note. Any medicine that sedates you overnight can impair you the next morning, sometimes more than you realise. If you are heavily sleep-deprived or newly started on a sedative, be cautious about driving until you know how it affects you.

Talking to your prescriber, including coming off

If you already take something to sleep and you want to stop, that is a conversation to have with your prescriber, not a thing to do abruptly on your own. I am not going to hand you a taper schedule, because the right one is individual and it belongs with your doctor. But it helps to know what that conversation tends to look like, so you feel able to start it.

The evidence here is genuinely encouraging. Deprescribing guidelines recommend a slow, planned taper for people who have used these medicines beyond a few weeks, because tapering improves the odds of stopping without serious harm (Pottie et al., 2018). Even something as simple as a plain-language information leaflet, mailed to long-term users, roughly quintupled the number who had stopped six months later compared with usual care, about 27 percent versus 5 percent, in one large trial (Tannenbaum et al., 2014). You are allowed to raise this. Prescribers expect it.

And this is the part that matters most for what comes next. In a trial of older, long-term users, pairing a supervised taper with structured psychological treatment for the insomnia itself produced by far the highest success rate, around 85 percent off the medication, well above tapering on its own (Morin et al., 2004). The drug comes out most cleanly when something is put in its place to handle the sleep.

Why a pill is aimed at the wrong level

Here is the through-line under all of this. Melatonin, antihistamines, z-drugs: each is an attempt to reach into a switched-on nervous system from the outside and turn the volume down. Sometimes, briefly, that buys a night. It rarely resolves the pattern, because the pattern was never a melatonin shortage. The pattern is arousal. The same goes for the supplements people rotate through, from magnesium glycinate onward: a different bottle, the same hope aimed at the same wrong level.

Sleep is the one area of life where trying harder tends to make things worse, and reaching for one more substance is a form of trying harder. The behavioural and cognitive work known as CBT-I is the most strongly evidenced approach to chronic insomnia (Riemann et al., 2023), and it earns that standing by working on the arousal and the beliefs that keep the loop running, rather than sedating over the top of them.

Insomnia Reset is built on that foundation and then adapts it for the specific problem of a wired, hypervigilant sleeper. For instance, it deliberately drops the nightly sleep diary that classic programs lean on, because for someone already watching their sleep too closely, logging every night tends to feed the very vigilance we are trying to settle. And most sleep advice fails for a simple reason: it hands you one technique and expects it to work no matter how activated you already are. A calm-minute exercise is useless the moment you are genuinely wired. The program's arousal-matched approach starts from how switched-on you actually are, and works from there.

If you want a clearer read on what is really driving your nights, the Sleep Clarity quiz is a short self-check. It is not a diagnosis, just a more honest picture than "I'm a bad sleeper" tends to give you.

One last thing, said as care rather than a disclaimer. If you snore heavily and wake unrefreshed, if your legs get restless the moment you lie down, or if your daytime sleepiness is severe enough to feel dangerous, get that assessed by your GP first. Those point to specific conditions with specific treatments, and no supplement or sleep technique is the right tool for them.

Frequently asked questions

How does melatonin work in the body?

Melatonin is a hormone released by the pineal gland when it gets dark, and it acts as a timing signal that tells your body it is night. It helps set your circadian rhythm rather than sedating you, so it does little to quiet a mind that is racing because it is alert, not because the clock is out of step.

Are melatonin gummies for sleeping any different from tablets?

The delivery format does not change the pharmacology. A gummy may be easier to take, and it is certainly marketed harder, but the same evidence applies: the AASM guideline recommends against melatonin for chronic insomnia regardless of how it is packaged (Sateia et al., 2017). If you do use one, check the amount and timing with a pharmacist.

Is melatonin safe for puppies?

That is a veterinary question, and this article is about adult human sleep. Safe amounts in animals depend entirely on species, weight and health, and human products are not designed for them. Ask your vet rather than extrapolating from anything written here.

What are the main diphenhydramine side effects?

Common ones include next-morning grogginess, dry mouth, blurred vision and constipation, all part of its anticholinergic action. That anticholinergic burden makes it a particularly poor choice for older adults, in whom sedatives carry a raised risk of cognitive and psychomotor problems (Glass et al., 2005). It also tends to lose its effect quickly with nightly use.

Is doxepin used for sleep or for insomnia?

Both phrases describe the same thing. At the low doses used at night, doxepin is prescribed to help with insomnia, mainly through its sedating antihistamine effect. Guidelines give it only a weak, conditional recommendation, so it is one option to discuss with a prescriber, not a guaranteed fix (Sateia et al., 2017).

Is zolpidem safe to take for sleep every night?

Zolpidem is intended as a short-term aid, generally for no more than a few weeks, because tolerance can develop quickly and dependable long-term data are thin (Riemann et al., 2023; De Crescenzo et al., 2022). Whether it suits you, and for how long, is a decision for you and your prescriber. If you have been on it a while, coming off is a conversation worth starting rather than a step to take alone.

Frequently asked questions

How does melatonin work in the body?

Melatonin is a hormone released by the pineal gland when it gets dark, and it acts as a timing signal that tells your body it is night. It helps set your circadian rhythm rather than sedating you, so it does little to quiet a mind that is racing because it is alert, not because the clock is out of step.

Are melatonin gummies for sleeping any different from tablets?

The delivery format does not change the pharmacology. A gummy may be easier to take, and it is certainly marketed harder, but the same evidence applies: the AASM guideline recommends against melatonin for chronic insomnia regardless of how it is packaged (Sateia et al., 2017). If you do use one, check the amount and timing with a pharmacist.

Is melatonin safe for puppies?

That is a veterinary question, and this article is about adult human sleep. Safe amounts in animals depend entirely on species, weight and health, and human products are not designed for them. Ask your vet rather than extrapolating from anything written here.

What are the main diphenhydramine side effects?

Common ones include next-morning grogginess, dry mouth, blurred vision and constipation, all part of its anticholinergic action. That anticholinergic burden makes it a particularly poor choice for older adults, in whom sedatives carry a raised risk of cognitive and psychomotor problems (Glass et al., 2005). It also tends to lose its effect quickly with nightly use.

Is doxepin used for sleep or for insomnia?

Both phrases describe the same thing. At the low doses used at night, doxepin is prescribed to help with insomnia, mainly through its sedating antihistamine effect. Guidelines give it only a weak, conditional recommendation, so it is one option to discuss with a prescriber, not a guaranteed fix (Sateia et al., 2017).

Is zolpidem safe to take for sleep every night?

Zolpidem is intended as a short-term aid, generally for no more than a few weeks, because tolerance can develop quickly and dependable long-term data are thin (Riemann et al., 2023; De Crescenzo et al., 2022). Whether it suits you, and for how long, is a decision for you and your prescriber. If you have been on it a while, coming off is a conversation worth starting rather than a step to take alone.

This article is general information written by a clinical psychologist. It is not a substitute for individual assessment or treatment. If sleep problems are affecting your health or daily life, speak with your GP or a registered psychologist.
If you need support now. If sleep loss comes with thoughts of harming yourself, or you feel you can't keep yourself safe, please reach out now — in Australia, Lifeline 13 11 14 or 13YARN 13 92 76; in the US, 988; in the UK, Samaritans 116 123. If you are in immediate danger, call your local emergency number.

Work on the mechanism, not another tip

Insomnia Reset is a structured, psychologist-designed program for exactly this pattern. If you're ready to work on the mechanism rather than chase another tip, that's what it's for.

Explore Insomnia Reset →