Once upon a time, I used to be obsessed with a spin instructor who taught at 7:30 p.m. twice a week. Even though I ended work at 5:30 p.m., I still waited two hours to get my sweat on—and don’t get me wrong, class was amazing. I was always in the greatest mood, and the rush of endorphins was just what I needed… until I tried to get to bed a few hours later, only to stare at the ceiling instead of fall asleep.
That’s right: It turns out the time you hit the gym can play a huge role when it comes to your sleep cycle. Studies have shown that vigorous exercise less than three hours before bedtime can lead to delayed sleep onset. "When you start to move, your heart beats faster to pump more blood to your muscles. This increases blood flow overall, including the blood flow to your brain—and greater blood flow to your brain increases energy and alertness,” says nutritionist and exercise physiologist Gabbi Berkow, RD.
The other thing is, your body also releases several hormones when you exercise, including adrenaline and norepinephrine. "Since exercise places physical ’stress’ on your body (in a good way!), it also increases circulating levels of hormones that are released during the stress response,” explains Berkow. "These hormones increase your heart rate, energy, and metabolism—all of which are helpful during exercise, but not conducive to falling asleep.”
After exercising, your body naturally goes through a cool-down period that brings your hormones back under control once activity stops. But the length can be different depending on the person. Some people can easily cool down within 30 minutes, while others take several hours… and clearly, I was the latter.
When should you go for a sweat session, then? Unfortunately, there's no one correct answer. "The best time of day to exercise is whenever you’re most consistent,” says Berkow. "You don’t see better results from working out in the morning, afternoon, or evening—you see the best results when you’re the most consistent.” So if you’re not a morning person, forcing yourself to wake up for a 6 a.m. run is probably not going to work on a regular basis.
If the only time you can fit in a workout is 8 p.m. (and you're planning to turn in within three hours), all hope isn’t lost, assures Berkow. "The more intense the exercise, the harder it will be to fall asleep immediately after. For example, if you lift weights or do cardio right before bed, you may have some trouble falling asleep because your body is amped up from the intense exercise,” she cautions.
However, as long as it’s not done too close to bed, "exercise can actually help you fall asleep because it exerts energy," says Berkow. "Relaxing exercises like slow, flowing yoga and stretching can be done right before bed, and these can be helpful for falling asleep, since they calm your body and nervous system down."
VIDEO: 5 Healthy Supplements Worth Your Money
As for the days you just can’t miss that late-night boxing class? Here's how to cool down faster. "Make sure you cool down and stretch right after your workout, as this will begin the process of helping your body calm down and return to normal,” says Berkow. "Take a warm, relaxing shower, and make a well-balanced dinner that combines at least 20 to 30 grams of protein, whole-grain carbohydrates, and green veggies. The combination of a hot shower and sitting down to a nutritious dinner helps get your body into a relaxed state.”
In addition, staying away from bright lights and phone screens for at least an hour before bed will also help, since the blue light from your phone inhibits the production of melatonin in your body—the hormone your body needs to regulate your circadian rhythm. By taking these precautions, you can hit up your favorite late evening class and still score the best sleep ever.
This Story Originally Appeared On Instyle