Studying for exams at the last minute might be the best way to learn, according to new research that has revealed that stress helps the brain form stronger memories.

Scientists have discovered that hormones produced when we are stressed causes changes inside the cells of our brains that help memories to be stored more effectively.

They found that stress hormones such as cortisol and adrenalin trigger changes in the way the genes inside neurons function and so enhances their learning ability.

Professor Hans Reul, a neuroscientist at the University of Bristol who has been leading the research, said that it suggests that studying while feeling stressed could help increase the ability of students when learning.

He said stress hormones appeared to boost a mechanism that "reprograms" the DNA in the brain, known as epigenetic modification, so that it either increases or decreases the expression of certain genes.

He said: "We often find that unpleasant memories are the ones that stay with us for the rest of our lives more than pleasant memories.

"This is because of the role that stress plays – it is clearly important from a biological point of view to remember something that hurt or threatened us.

"It seems like the stress hormones bind to specific receptors in our brains that enhance the control of the epigenetic mechanisms that are involved in learning and memory.

"They boost these epigenetic control mechanisms and this leads to an enhanced expression of the genes that play a role in leaning and memory.

"So essentially the stress hormones are enhancing the process that is normally taking place when you are learning."

This enhanced learning means the consolidation of the memories are strengthened in the hippocampus – the part of the brain involved in memory and learning.

It is thought that the reprogramming of the genes in the brain in response to stress causes nerve cells to grow larger and develop larger communication networks.

Dr Reul presented his findings at the annual conference of the British Neuroscience Association and in the journal Experimental Neurology.

At moments of stress, cortisol and adrenalin are released into the blood stream to produce a variety of responses including increasing the amount of sugar in the blood, aiding the metabolism and suppressing the immune system.

In human evolutionary history this would have helped assist escape from dangerous situations and the action of these hormones on the brain would have helped form strong memories that would have enabled our ancestors to avoid such situations in the future.

But Dr Reul warned that while some stress can be good for memory formation, too much stress can have the opposite effect.

"When we are extremely stressed it is not possible to pick up any new information," he said. "The brain goes into an override mode and so the memory formation is not efficient. Chronic, long term stress is also not good."