We have all been there. Not enough sleep. Your brain gets foggy. Your memories. Your ability to recall not as sharp. It turns out, not necessarily the amount of sleep you're getting but instead the... See More
We have all been there. Not enough sleep. Your brain gets foggy. Your memories. Your ability to recall not as sharp. It turns out, not necessarily the amount of sleep you're getting but instead the kind of sleep. But tonight abc's amy robach on what it takes to get those short-term memories into your brain's long-term hard drive. Reporter: Scientists have discovered what's happening at night may be the key to why memories fade as you age. Turns out, it's not how much you sleep but what kind of sleep that may be crucial. It's called slow-wave sleep. The nondream deep sleep that occurs in the first few hours of a sleep cycle. Your brain waves are different with higher peaks and valleys. That sleep is actually transferring memories from one location within the brain, a short-term location to a long-term location. Reporter: We have all heard by testing memory by recalling dates and faces. But researchers asked people to memorize ordinary words paired with nonsense words, like false and dipotabia. Jump and villened. The theory, that the ability to retain previously unknown information declines wh age. Can they remember those word pairings after sleep? Older patients with less slow wave sleep had a harder time remembering the words. If you had bad sleep your memory was a lot worse. If we can improve sleep, we could actually improve memory. Reporter: The good news, no matter your age, doctors say there is a way to improve slow-wave sleep and thus your memory. Exercise. Exercise may be specially interesting in relation to this deep sleep. Amy is with us now. This is really fascinating. During slow-wave sleep, your memories are being moved from the front to the back. Right. And the problem is, for people who have aged it's a natural process to have atrophy in the front part. It doesn't do a very good job of taking those memories and putting them back in the hard drive where they're stored and be able to be accessed. You mentioned exercise, does the timing of the exercise or kind of exercise matter? Researchers say it's very important not to exercise close to bedtime because you'll be wired and charged. You won't be able to get any sleep, let alone deep sleep.
This transcript has been automatically generated and may not be 100% accurate.