We’re all fucking tired. We’ve got a pile of assignments and homework to do, essays that need to be written and exams to study for. On top of that, we’re trying to fit in training sessions, shifts at work, study groups and the latest episode of whatever show we’re watching into the week. Usually, the first thing to get the cut is sleep; all nighters are inevitable at some point in any student’s life. Whether it’s a hectic week or you’ve just procrastinated to the point of no return, eventually sleep will need to be sacrificed and you’ll push through the night, bleary eyed, just to get shit done.

This is why naps are so damn important. It’s no big secret that getting enough sleep improves memory, focus and overall productivity. When you can’t seem to get a solid sleep schedule in place (especially during exam period), naps are the next best thing.

Pulling an all nighter here and there isn’t going to kill you. While you might feel sleepy as fuck the next day, you’re usually right by the time you have a decent sleep.

The thing is, naps can go one of two ways. Either they’ll be a solid way to bank up some sleep, let you forget about all your work for a while and energise you enough to actually get something done. Or, you’ll wake up feeling like you’ve been hit by a train with no energy to do anything except go back to sleep.

A bad nap can make you shitty, even more sleepy and seriously regretting ever laying down in the first place. But here’s how to avoid that.

1. Schedule them in

The perfect time of day to nap depends on what time you’re waking up and going to bed. Most of us will be getting up pretty early which means we’ll crash in the early afternoon. The lucky ones who get to sleep in thanks to a free period in the morning will be able to schedule a nap later in the day. The best way to work it out is to use this nap wheel–which will give you your ideal nap time based on your morning alarm.

2. Time limits

There’s a lot of advice out there about how long your nap should be. After a bit of digging, the safe bet seems to be around the 15-25 minute mark (research says that a 26 minute nap can enhance performance by 34% and overall alertness by 54%). 45 minutes it also meant to have a good effect, but any longer and you’ll wake up groggy and wondering what year it is.

3. Have a coffee before

If you’re going for a quick nap, having a coffee before you go to sleep can help you avoid that groggy feeling that comes just after waking up. It’s pretty straightforward–it takes around 20 minutes for your body to respond to the effects of caffeine so by taking a quick nap, the stimulant kicks in just as you’re waking up.

4. Prep nap

If you know you’re going to be pulling an all nighter, or have a massive night shift coming up, a prep nap can help you get through it. Researchers have found that a long nap—of two hours or more—can significantly improve alertness for up to 24 hours. Plus, a prep nap before depriving yourself of sleep can help more than the nap you’re going to take the day after.