Walnuts, almonds, pistachios, and cashews all contain nutrients that support better sleep, but walnuts have the strongest clinical evidence behind them. A randomized trial found that eating about 40 grams of walnuts daily at dinner for eight weeks significantly improved sleep quality, reduced the time it took to fall asleep, and lowered daytime sleepiness. The other nuts contribute meaningful amounts of magnesium, tryptophan, and melatonin, all of which play roles in your body’s sleep cycle.
Walnuts: The Strongest Evidence
Walnuts are the only nut with a dedicated clinical trial measuring their effect on sleep. In a crossover study published in Food and Function, 76 young adults ate 40 grams of walnuts (roughly a small handful) with dinner every day for eight weeks. Compared to a no-nut control period, the walnut phase produced measurable increases in a urinary marker of melatonin, the hormone that signals your brain it’s time to sleep.
The results were notable across multiple sleep measures. Participants fell asleep faster, reported better overall sleep quality, and experienced less daytime drowsiness. The researchers confirmed that higher melatonin levels correlated directly with improved sleep efficiency, meaning people spent more of their time in bed actually sleeping. Walnuts naturally contain both melatonin and tryptophan, the amino acid your body converts into serotonin and then into melatonin.
Pistachios: Highest Melatonin Content
If you’re looking for the nut with the most melatonin per bite, pistachios win. Lab analysis found that pistachios contain roughly twice the melatonin of almonds, averaging about 2.6 nanograms per gram compared to 1.2 nanograms per gram in almonds. Some pistachio varieties contain dramatically more, with one cultivar measuring over 12,000 picograms per gram.
No large clinical trial has isolated pistachios’ effect on sleep the way the walnut study did, but their melatonin concentration makes them a reasonable choice as an evening snack. They also provide magnesium and tryptophan, giving your body multiple building blocks for sleep-promoting chemistry.
Almonds: Rich in Magnesium
Almonds are one of the best dietary sources of magnesium, and magnesium plays a specific role in sleep. It helps relax muscles, calms the nervous system, and modulates your body’s production of melatonin. Magnesium also helps reduce cortisol, the stress hormone that can keep you wired at night. A one-ounce serving of almonds (about 23 nuts) delivers roughly 77 milligrams of magnesium, which is close to 20% of the daily recommended intake for most adults.
People who are low in magnesium tend to have more trouble falling and staying asleep, so almonds can be particularly helpful if your diet is lacking in this mineral. They contain melatonin too, just at lower levels than pistachios or walnuts.
Cashews: Tryptophan and Magnesium Combined
Cashews are high in both tryptophan and magnesium, making them useful for sleep through a two-step pathway. Your body converts tryptophan into serotonin, a chemical that regulates how long and how well you sleep. Serotonin is then converted into melatonin, which controls your sleep-wake cycle. Cashews essentially give your body the raw materials for this entire chain.
They don’t have the melatonin punch of pistachios or the clinical trial backing of walnuts, but they’re a solid option, especially if you prefer their taste and are more likely to eat them consistently.
Chestnuts and Hazelnuts: Lesser-Known Options
Two nuts that rarely appear in sleep conversations deserve a mention. Chestnuts contain a significant amount of GABA, the brain’s main calming neurotransmitter. GABA reduces neural activity and is associated with reduced anxiety and improved sleep onset. Most sleep medications work by enhancing GABA’s effects, so getting it through food, even in smaller amounts, works in the same direction.
Hazelnuts contain serotonin itself, not just its precursor tryptophan. Serotonin from food primarily acts in the gut, where it influences the nervous system’s signaling. Whether dietary serotonin from hazelnuts meaningfully affects sleep in the brain is still an open question, but it’s a biochemically interesting feature that sets them apart from other nuts.
How Nuts Promote Sleep
Nuts don’t work like a sleeping pill. They provide a combination of nutrients that support your body’s natural sleep processes over time. The key players are:
- Melatonin: Directly signals your brain that it’s nighttime. Walnuts and pistachios are the richest sources.
- Tryptophan: An amino acid your body converts first into serotonin, then into melatonin. Found in all nuts, with cashews and walnuts being especially high in protein-bound tryptophan.
- Magnesium: Relaxes muscles, lowers cortisol, and supports melatonin production. Almonds and cashews are top sources.
These nutrients work together rather than in isolation. Magnesium supports the enzymes that convert tryptophan into serotonin. Serotonin feeds into melatonin production. Eating nuts that provide all three gives your body the full toolkit.
How Much to Eat and When
Dietary guidelines recommend about 30 grams of nuts per day, which is roughly one ounce or a small handful. The walnut sleep study used 40 grams, slightly above this standard recommendation. A typical handful naturally lands around 36 grams, so grabbing a casual palm-full gets you in the right range without weighing anything.
Timing matters. The walnut trial had participants eat their nuts at dinner, which makes sense given that melatonin and tryptophan need time to be absorbed and processed. Eating your nuts one to two hours before bed gives your body time to digest them and begin converting those nutrients. Eating them too close to bedtime can cause discomfort, since nuts are calorie-dense and high in fat, which slows digestion.
Consistency also appears to matter more than any single serving. The walnut study ran for eight weeks before measuring results. Think of sleep-promoting nuts as a long-term dietary habit rather than a one-night fix. Adding a small handful of walnuts, almonds, or pistachios to your evening routine is a low-risk strategy that, based on current evidence, genuinely supports better sleep over time.

