Sleep & HealthMar 30, 20267 min read

Exercise and Sleep: How Many Hours Before Bed Should You Work Out?

Exercise and sleep have a complicated relationship. On one hand, regular physical activity is one of the most effective ways to improve sleep quality. On the other hand, working out at the wrong time can keep you staring at the ceiling for an extra half hour or more.

Exercise and Sleep: How Many Hours Before Bed Should You Work Out?

TL;DR

Exercise is one of the best natural sleep aids, but timing matters more than most people think. A 2025 study of 14,689 people across 4 million nights found that exercising within 4 hours of bedtime delays sleep onset by up to 36 minutes. High-intensity workouts close to bedtime raise your resting heart rate and lower heart rate variability. Finishing exercise 4+ hours before bed eliminates measurable sleep disruption. Moderate exercise done at the right time increases deep sleep and helps you fall asleep faster.

The Largest Study on Exercise Timing and Sleep

In 2025, researchers from Monash University published the biggest study ever conducted on exercise timing and sleep in Nature Communications. The team, led by Josh Leota and Elise Facer-Childs, analyzed data from 14,689 physically active adults wearing biometric trackers over one full year. That gave them over 4 million nights of sleep data paired with exercise records.

The findings were clear. Strenuous workouts within 2 hours of bedtime delayed sleep onset by an average of 36 minutes. When people exercised after their usual bedtime, the delay more than doubled to 80 minutes. Late exercise also reduced total sleep by up to 43 minutes.

But here is the good news. Exercise bouts that ended 4 or more hours before sleep onset showed no measurable negative effects on sleep timing, duration, or quality. The problem is not exercise itself. The problem is exercising too close to when your body needs to wind down.

The study also tracked what happened inside the body during sleep. People who exercised intensely close to bedtime had elevated nocturnal resting heart rates and lower heart rate variability (HRV), a measure of how well your nervous system can shift between active and rest modes. Lower HRV during sleep means your body is still in a recovery state rather than a deeply restful one.

Why Intense Exercise Keeps You Awake

During a hard workout, your core body temperature rises by 1 to 2 degrees Celsius. Your heart rate climbs. Cortisol and adrenaline surge. Your sympathetic nervous system, the "fight or flight" system, kicks into high gear.

Sleep requires the exact opposite. Falling asleep is tied to a natural drop in core body temperature. Your parasympathetic nervous system, the "rest and digest" side, needs to take over. HRV needs to rise. Heart rate needs to fall. When you finish a HIIT session or a hard run at 9 PM and try to sleep at 10 PM, your body has not had enough time to make that switch.

This is especially true for high-intensity interval training (HIIT), competitive sports like football or basketball, and long runs at a vigorous pace. These activities push your body temperature and heart rate to peak levels, and the cooldown period can take 2 to 4 hours.

Does That Mean Evening Exercise Is Bad?

Not at all. A 2019 systematic review and meta-analysis by Stutz, Eiholzer, and Spengler, published in Sports Medicine, looked at 23 studies on evening exercise and sleep. Their conclusion surprised many people: moderate evening exercise actually improved sleep in most cases.

Specifically, they found that evening exercise increased slow-wave sleep (deep sleep) by 1.3 percentage points and reduced stage 1 sleep (the lightest, least restorative phase) by 0.9 percentage points. These are small but meaningful shifts toward better sleep quality. If you want to learn more about why deep sleep matters, check out our guide on how to sleep deeper.

The catch? The benefits disappeared when people did vigorous exercise ending less than 1 hour before bedtime. At that point, the stimulating effects outweighed any sleep benefits.

So the relationship is more nuanced than "evening exercise is bad." Moderate evening exercise is fine, and may even help. Vigorous exercise too close to bedtime is the problem.

What Type of Exercise Helps Sleep the Most?

A 2024 network meta-analysis by Li and colleagues in Frontiers in Psychology examined 58 randomized controlled trials with 5,008 participants. They ranked different exercise types and prescriptions by their effect on sleep quality.

The most effective combination for better sleep was:

  • Frequency: 4 times per week
  • Duration per session: 30 minutes or less
  • Intensity: High (when done earlier in the day)
  • Program length: 9 to 10 weeks
  • Type: Combined exercise (mixing aerobic and resistance training)

Combined exercise had a large effect size (SMD = -0.99), meaning it substantially improved sleep scores compared to no exercise. Aerobic exercise alone (SMD = -0.56) and traditional mind-body exercises like tai chi and qigong (SMD = -0.57) were also effective, just less so than a combined approach. The takeaway: you don't need marathon training sessions. Four 30-minute workouts per week, mixing cardio and strength, is the sweet spot for sleep improvement.

How Exercise Boosts Deep Sleep

Regular exercise does not just help you fall asleep faster. It changes the architecture of your sleep in ways that make you feel more rested.

Research published in Scientific Reports found that exercise increases the stability of slow-wave sleep, the deepest and most restorative phase. During slow-wave sleep, your brain produces delta waves, your muscles repair, growth hormone is released, and memories consolidate. Athletes and regular exercisers tend to spend more time in this phase compared to sedentary people.

The mechanism involves core body temperature. Exercise raises your body temperature, and the subsequent cooldown triggers a stronger-than-usual drop in core temperature later in the day. This temperature decline is one of the signals your brain uses to initiate and maintain deep sleep. Think of it like a pendulum: the higher the temperature goes during the day, the lower it swings at night, as long as enough time passes between exercise and sleep.

This temperature mechanism also explains why morning and afternoon exercise tends to produce the best sleep outcomes. By the time bedtime arrives, your body has had 6 to 10 hours to cool down, creating ideal conditions for deep, restorative sleep.

The Sleep-Exercise Feedback Loop

Sleep and exercise have a bidirectional relationship. Better sleep leads to better workouts, and better workouts lead to better sleep.

When you are sleep-deprived, your reaction time slows, your perceived effort increases, and your motivation drops. A night of poor sleep can reduce exercise performance by 10 to 30% depending on the task. You are more likely to skip the gym entirely.

On the flip side, people who exercise regularly report 65% better sleep quality according to a National Sleep Foundation poll. They also experience fewer daytime sleepiness symptoms and less trouble falling asleep. This feedback loop means that getting exercise timing right can create an upward spiral. Good sleep fuels better workouts, which in turn fuel better sleep. The connection between physical activity and rest also extends to body composition. If you are curious about how sleep quality affects weight management, our article on sleep and weight loss covers the hormonal links in detail.

A Practical Guide to Exercise Timing

Here is a simple framework based on the research:

Morning exercise (6 AM to 10 AM). Best for sleep if your schedule allows it. Exposure to morning sunlight during outdoor exercise also helps set your circadian rhythm. Associated with the greatest improvements in deep sleep.

Afternoon exercise (12 PM to 4 PM). Also excellent. Core temperature peaks naturally in the late afternoon, making this a time when physical performance is often at its best. Plenty of cooldown time before bed.

Early evening exercise (5 PM to 7 PM). Generally fine, especially for moderate-intensity workouts. Just make sure you finish at least 4 hours before your target bedtime.

Late evening exercise (after 8 PM). This is where the risk increases. If you must exercise late, choose low-intensity options: a gentle walk, light stretching, yoga, or an easy swim. Avoid HIIT, heavy lifting, or competitive sports within 2 hours of bedtime.

Building a consistent exercise routine is one piece of the puzzle. For a more complete picture of habits that support good sleep, take a look at our sleep hygiene checklist.

What to Do If You Can Only Exercise at Night

Not everyone can work out in the morning. Shift workers, parents with young kids, and people with long commutes often find that late evening is the only realistic time to exercise. Here are evidence-based strategies to minimize the impact on your sleep:

  1. Choose lower intensity. A brisk walk, a light swim, or a slow-paced yoga flow will give you health benefits without spiking your heart rate and temperature as much as a HIIT class.
  2. Cool down intentionally. Spend 10 to 15 minutes stretching and breathing slowly after your workout. A lukewarm (not hot) shower can help lower your core temperature faster.
  3. Give yourself at least 90 minutes. Even if 4 hours is ideal, the 2019 Stutz meta-analysis found that moderate exercise finishing more than 1 hour before bed did not harm sleep.
  4. Track your data. Use a sleep tracker like piliq to see how your body personally responds to different exercise times and intensities. Individual variation is real. Some people tolerate late exercise well, while others are highly sensitive.
  5. Keep the room cool. Set your bedroom temperature to 18 to 19 degrees Celsius (65 to 67 degrees Fahrenheit) to help offset any remaining body heat from your workout.

FAQ

How many hours before bed should I stop exercising?

Research shows you should finish vigorous exercise at least 4 hours before bedtime. A 2025 study in Nature Communications found that intense workouts within 2 hours of bed delayed sleep onset by 36 minutes and reduced total sleep by up to 43 minutes. Moderate exercise, like a brisk walk, is generally safe up to 1 hour before bed.

Does exercise improve sleep quality?

Yes. Regular exercise is one of the most effective natural ways to improve sleep. A meta-analysis of 58 studies found that exercising 4 times per week for 30 minutes significantly improved sleep quality scores. Exercise increases deep slow-wave sleep, reduces the time it takes to fall asleep, and improves heart rate variability during the night.

What is the best type of exercise for better sleep?

Combined exercise, mixing aerobic activity with resistance training, shows the largest sleep improvement. A 2024 network meta-analysis found combined exercise had an effect size of SMD -0.99, nearly double that of aerobic exercise alone (SMD -0.56). The optimal prescription is 4 sessions per week, 30 minutes each, maintained for at least 9 to 10 weeks.

Is it okay to do yoga or stretching before bed?

Yes. Low-intensity activities like yoga, gentle stretching, and light walking do not significantly raise core body temperature or heart rate. The 2025 Monash University study found that low-strain exercise close to bedtime had minimal impact on sleep. These activities may actually help by reducing muscle tension and activating the parasympathetic nervous system.

The Bottom Line

Exercise is one of the best things you can do for your sleep. Regular physical activity increases deep sleep, reduces the time it takes to fall asleep, and improves overall sleep quality. But the timing matters. The 2025 Nature Communications study makes the strongest case yet: finish vigorous workouts at least 4 hours before bed. If you exercise within that window, keep the intensity low.

And if you are just starting a fitness routine, know that consistent moderate exercise, even just 30 minutes four times a week, can meaningfully improve your sleep within 9 to 10 weeks. Your body wants to move during the day and rest at night. Give it both, in the right order, and the results will show up in your sleep data.

piliq measures your sleep every night and tracks how your exercise timing correlates with sleep quality. Find the optimal workout schedule for your body with real data.

References

  1. Leota, J., Presby, D.M., Le, F., Czeisler, M.E., Mascaro, L., Capodilupo, E.R., Wiley, J.F., Drummond, S.P.A., Rajaratnam, S.M.W., & Facer-Childs, E.R. (2025). Dose-response relationship between evening exercise and sleep. Nature Communications, 16, 3297. https://doi.org/10.1038/s41467-025-58271-x
  2. Stutz, J., Eiholzer, R., & Spengler, C.M. (2019). Effects of evening exercise on sleep in healthy participants: A systematic review and meta-analysis. Sports Medicine, 49(2), 269-287. https://doi.org/10.1007/s40279-018-1015-0
  3. Li, L., et al. (2024). Optimal exercise dose and type for improving sleep quality: A systematic review and network meta-analysis of RCTs. Frontiers in Psychology, 15, 1466277. https://doi.org/10.3389/fpsyg.2024.1466277
  4. Kredlow, M.A., Capozzoli, M.C., Hearon, B.A., Calkins, A.W., & Otto, M.W. (2015). The effects of physical activity on sleep: A meta-analytic review. Journal of Behavioral Medicine, 38(3), 427-449. https://doi.org/10.1007/s10865-015-9617-6

Related Articles

← Back to Articles