How your food affects your sleep

If you've ever tossed and turned after a late, heavy dinner, you already know sleep and food are connected. The research backs that up, and the link runs both ways.

Sleep and nutrition have a two-way relationship: Poor sleep can affect appetite and food choices.
Sleep Foundation Source [1]

And what you eat can shape the night that follows.

Your overall pattern matters more than one food

Eating with plenty of fiber, fruits and vegetables is linked to better sleep quality [1]. Diets high in saturated fat (the fat that's solid at room temperature, like butter) and added sugar may contribute to poorer sleep [1].

A 2016 study by St-Onge and colleagues, published in the Journal of Clinical Sleep Medicine, found that low fiber and high saturated fat and sugar were linked to lighter, less restorative sleep with more brief wake-ups [2].

These studies show links, not proof that one food causes better or worse sleep. Still, they point to an easy place to start: what's on your plate most days.

A couple cooking vegetables together at a stove in a small apartment kitchen in the early evening, herbs on the windowsill

Sleep-friendly nutrients in everyday food

A few nutrients come up again and again in sleep research. Tryptophan, magnesium, melatonin and complex carbohydrates may support healthy sleep [1].

Rows of leafy greens in a kitchen garden at dusk under a thin crescent moon

Four nutrients linked to sleep

Where each one shows up in food, and why it matters for your night.

Magnesium

A mineral that supports muscle relaxation and a healthy nervous system. You'll find it in leafy greens, beans, nuts, seeds and whole grains.

Tryptophan

An amino acid, one of the building blocks of protein.

Role
A building block for melatonin

Melatonin

The hormone that tells your body it's night. Tart cherries have above-average amounts of it.

Food example
Tart cherries

Complex carbohydrates

Slower-digesting carbs found in foods like whole grains and beans. They're on the list of nutrients that may support sleep.

Food examples
Oats, whole grains, beans

Foods with fiber generally bring magnesium too [5]. So one swap covers two habits linked to better sleep.

Halved kiwis and a bowl of tart cherries beside a glass of cherry juice on a weathered garden table at golden hour

Foods and drinks that help you sleep: what research found

You may have seen long lists of foods to eat before bed. Only a few foods have been studied on their own, and the studies so far are small.

A cherry tree branch heavy with dark red fruit silhouetted against a rising full moon
Kiwi and tart cherry findings as summarized by the Sleep Foundation.
Food or drinkWhat a study foundHow strong
KiwiTwo kiwis an hour before bed: fell asleep faster, slept more, better sleep qualityOne small study
Tart cherry juiceMore total sleep time in a small pilot group with insomniaOne small pilot study
Source [3]

What to eat to sleep instantly

No food works instantly, so think of food as one part of your wind-down.

A systematic review of tart cherry says the evidence is still limited, and the studies so far differ from each other [4]. If you enjoy it, it's a simple thing to try.

Worst foods for sleep, and what to choose instead

None of these are off limits. It's mostly about when you have them and how your body responds.

Caffeine in less obvious places

Caffeine isn't only in coffee. It's also in tea, soda, energy drinks and chocolate [1], so an evening square still counts toward your cutoff.

Your afternoon caffeine
About 5 hours in

On average, half the caffeine has left your body. [3]

The rest lingers

The other half is still in your system as evening comes.

Stop 6 hours before bed

Or 8 hours if caffeine hits you hard. [3]

Bedtime with less caffeine on board

Alcohol in the evening

A drink may help you fall asleep faster, but it's linked to lower-quality sleep and more waking overnight [1]. It can also shorten REM sleep, the dreaming stage [3].

Spicy food and sleep

Spicy foods can trigger heartburn, indigestion and reflux, and they raise your body temperature [3]. If you love heat, try enjoying it at lunch.

High-fat, fried and sugary foods

Fried, high-fat and junk foods in the evening can make reflux more likely [1].

Late sweets are a bigger topic of their own, so we cover them in why sugar may be keeping you up at night.

Friends sharing bowls of noodles in a cozy restaurant booth at night, warm lights blurred behind them

How long before bed should you stop eating?

Not eating in the two hours before bed may help you avoid reflux at night [1]. If heartburn is something you know well, MedlinePlus suggests a bigger gap of 3 to 4 hours [6].

Here's why, step by step. It comes down to a valve at the bottom of your esophagus, the tube that carries food to your stomach [6].

A big meal close to bed
Your stomach is full

You head to bed while your meal is still settling.

You lie down

Stomach contents press harder on the valve, called the LES. [6]

Reflux can follow

Pressure on that valve lets stomach contents push back up. [6]

Heartburn that can wake you

What is a normal eating schedule?

There's no single right schedule. What research points to is regularity: when you eat can affect your circadian rhythm, your body's 24-hour clock [1].

A sample sleep-friendly evening

Here's one way to space out your evening, with each step timed back from your bedtime.

A sleep-friendly evening of eating

  1. 6 hours before bed

    Last caffeine

    Your caffeine cutoff from above.

  2. 3 hours before bed

    Dinner on the table

    Vegetables, beans or whole grains on your plate. If you get heartburn, eat a bit earlier.

  3. 2 hours before bed

    Big meals are done

    This gives dinner time to settle before you lie down.

  4. 1 hour before bed

    A small snack, only if you're hungry

    Something light, like a kiwi, if reflux isn't a problem for you.

  5. 30 minutes before bed

    A warm, caffeine-free drink

    A calm cue that the day is done. Skip the nightcap.

  6. Bedtime

    Lights out

    Your evening did the groundwork.

For more on that last hour, see how winding down helps you fall asleep.

A family clearing plates from a dining table as the last daylight fades through the window

Does eating less affect sleep?

It can. Not eating enough fat, carbohydrates or protein has been linked to less sleep or worse-quality sleep [1].

So if you're cutting back, notice how your nights feel.

Low-carb diet and sleep problems

We didn't find strong research on low-carb eating and sleep on its own. The links above, on eating too little and on complex carbs, are the closest guide we have.

Is fruit at night bad for sleep?

We didn't find good evidence that fruit at night harms your sleep.

If fruit late in the evening bothers you, enjoy it earlier.

What to eat before bed to lose weight

No snack is a shortcut to weight loss. If you'd like something before bed, keep it small and light.

A woman taking a small handful of walnuts from a glass jar in a pantry lit by soft evening light

When food isn't enough: magnesium and tryptophan

Sometimes you eat well and still lie awake. Some supplements use the same sleep-linked nutrients, so here's what the research on them shows.

Magnesium

A review of 3 studies with 151 older participants with insomnia suggested magnesium may help them fall asleep faster [7].

Those studies were small and low quality, and a larger review of 9 studies with 7,582 people had conflicting findings [7]. The research is early, and larger trials lasting more than 12 weeks are still needed [7].

L-tryptophan

As a supplement, L-tryptophan has been studied for sleep. How it works for sleep is still unclear, and the data so far is very limited [8].

A man sitting on a back deck at twilight with a mug of herbal tea, watching the first stars appear

Frequently asked questions

What is the 3:2:1 rule for sleeping?

You may have seen it online, but we didn't find it in the medical sources we trust. The caffeine and meal timing earlier in this article is what they do support.

Safety notes and when to see a doctor

Food changes are worth trying, but some sleep trouble has a medical cause. Here's when to bring in a professional.

References

  1. Nutrition and Sleep: How Diet Affects Sleep Quality. Sleep Foundation.↩
  2. Read the 10 most-viewed sleep research papers published in JCSM in 2016. American Academy of Sleep Medicine.↩
  3. Foods That Help You Sleep. Sleep Foundation.↩
  4. The Effect of Tart Cherry on Sleep Quality and Sleep Disorders: A Systematic Review. PMC (Food Science & Nutrition).↩
  5. Magnesium - Health Professional Fact Sheet. NIH Office of Dietary Supplements.↩
  6. Heartburn: MedlinePlus Medical Encyclopedia. MedlinePlus (NIH).↩
  7. In the News: Magnesium Supplements for Sleep Disorders. NCCIH (NIH).↩
  8. Sleep Disorders: In Depth. NCCIH (NIH).↩

These statements have not been evaluated by the Food and Drug Administration. This product is not intended to diagnose, treat, cure, or prevent any disease.