For decades, sleep experts have cautioned against working out late in the day, warning that revving up our systems too close to bedtime makes it harder to sleep. But new evidence supports the opposite assertion—that exercise, no matter when it’s done, helps us sleep better.

The shakeup comes as the result of a recent survey conducted by the National Sleep Foundation. For the poll, 1,000 adults answered questions about their exercise and sleep habits. Among other things, each participant classified his/her own level of physical activity into one of four different categories—no activity…light activity (e.g., walking)…moderate activity (yoga, tai chi, lifting weights)…or vigorous activity (running, cycling, swimming, competitive sports).

Surprising: No significant differences in sleep quality were found between people who exercised within four hours of bedtime and those who exercised at the same activity level earlier in the day. Working out at any time of the day or evening led to better slumber across the board.

In terms of how well people slept, the differences between exercisers and nonexercisers were quite pronounced. For instance, working out improved the respondents’…

  • Overall quality of sleep. Among vigorous exercisers, 67% said that they got a good night’s sleep every night or almost every night on work nights, as did 58% of moderate exercisers and 56% of light exercisers. Only 39% of nonexercisers were able to make the same claim.
  • Ability to fall asleep. The “no activity” group spent an average of 26 minutes counting sheep each night, while light exercisers took 23 minutes, moderate exercisers took 21 minutes and vigorous exercisers took just 17 minutes to drop off.
  • Ability to stay asleep. About 50% of nonexercisers but only 33% of vigorous exercisers reported waking up in the middle of the night. Similarly, 15% of nonexercisers but only 9% of vigorous exercisers said that they usually woke up too early and had trouble getting back to sleep.
  • Risk for sleep apnea, a dangerous interruption in breathing when asleep that increases the risk for heart disease and stroke. In this survey, 44% of nonexercisers were judged to be at moderate risk for sleep apnea, compared with 26% of light exercisers, 22% of moderate exercisers and just 19% of vigorous exercisers. The results make sense, given that body mass index affects the likelihood of developing sleep apnea—and it generally improves with regular exercise.

The researchers noted that, while the traditional recommendation against exercising in the evening should not be generalized to the entire population, it may be a useful guideline for certain people with insomnia. So if you suffer from insomnia, try exercising in the evening if that is the most convenient time for you—but if you find that this makes it even harder for you to drop off, figure out a way to schedule your workouts earlier in the day.

How much exercise is enough: Although sleep generally was best among participants who exercised the most, even a brief daily walk was sufficient to bring about a significant improvement in sleep quality. If you have not been in the habit of exercising, check with your doctor to see whether you have any limitations, then start slowly and build up gradually. You don’t need to turn into a gym rat to enjoy better sleep. Remember—whenever you do it, provided that you do do it, working out regularly is likely to lead to sweeter slumber.