It's spooky season. What happens in your brain when you're scared?

The human body is a complicated miracle, with hundreds of tiny factors working together to keep you alive. Sometimes that means you scream when your friend jumps out from behind a closet door.

NBC Universal, Inc.

It’s almost Halloween, which means scary movies and haunted houses are all around. But what does your brain tell your body when you get spooked, and why? News4’s Maggie More reports.

Picture this: You're walking alone late one night, down a darkened street after leaving a Halloween party. No one is around, and your surroundings are eerily quiet. Then, suddenly, you hear rustling, and a loud CLANG! from an alley to your side.

The noise wasn't a real threat -- just a raccoon sifting through a garbage can. But your heart is beating out of your chest, you're breathing heavier than you were mere moments before, and you suddenly feel hyperaware of every shadow.

Congratulations! You just got acquainted with your sympathetic nervous system. Here's what it is, and what it has to do with feeling scared.

What is the nervous system?

Like your digestive system, your nervous system is just a part of your body, made up of a variety of organs, all working together to fulfill some purpose that keeps you alive.

Despite the name, your nervous system doesn't just regulate whether you feel nervous -- it has to do with nerves, and how your brain sends signals to your body.

"There are a lot of functions in our body that are automatic," Gabriela Romo, a psychotherapist based in Chevy Chase, Maryland, told News4. "We never think about digesting food, we never think about breathing or our hearts beating."

The nervous system controls what happens automatically and how. It's divided into two modes, and only one mode can be active at a time -- kind of like a light switch.

There's the parasympathetic nervous system, which is active when you're in safe situations that let you rest and go about daily life.

Then there's the sympathetic nervous system, which is active during emergencies.

"It is more about the fight or flight response, when we have to respond to a threat or an attack," Romo said.

As attention turns toward Halloween, ghost stories and the unexplained get a new life. News4’s Tommy McFLY caught up on some local tales from the woman who wrote the book.

What does your sympathetic nervous system do when you're scared?

The sympathetic nervous system is set off when something happens to activate your amygdala. The amygdala is a small part of the brain, deep in the middle, that regulates instinctual responses and emotion -- including fear.

When your amygdala is activated because you saw or heard something that could be a threat -- like a racoon knocking over a trash can in the dark, or someone running toward you -- your brain tells your body to release stress hormones.

Those stress hormones, like cortisol and adrenaline, cause a "near-instantaneous" response, according to Harvard University.

Then, Romo said, "we see body changes, like our heart pounds, we increase our breathing, our blood vessels get dilated."

More blood gets pumped through your veins, and you breathe faster, sending more oxygen along with it. The extra oxygen to your brain lets you see and understand more of your environment.

The whole response essentially floods your body with extra energy, so you're ready to deal with the perceived threat. And it often happens so quickly that your thinking brain doesn't fully process what happened until after you've already jumped into action.

If getting spooked makes your brain step on the gas pedal that is the sympathetic nervous system, your parasympathetic nervous system acts like the brakes, according to Harvard.

Once the threat has passed, your parasympathetic nervous system jumps in to regulate your body and brain back down to normal levels.

Fight, Flight, or Freeze?

You may have heard of the "fight or flight" response before. It's a simple way of referring to the physiological response your body has when you're threatened, Romo said. And both responses come down to survival.

Fight

"Fight, basically, is when your body says, 'You know what? I can overpower this danger,'" Romo said.

Those quick instincts deep in your brain tell you that the best way to act is by, literally, fighting your way out. Your pupils dilate so you can see better, your muscles tense in preparation for use, and you might even feel the urge to punch. (This is why unlucky haunted house actors sometimes get hit.)

Flight

Flight, on the other hand, is when your body tells you to run away.

"[It's] kind of like your body telling you, 'You know what, I cannot overpower this danger,'" Romo said. "So, your body, the way that it responds is like, getting all the energy in our legs so that we can run very fast."

Your hands might "feel very numb," or you may feel trapped generally and get the urge to flee, she added.

Freeze

The freeze response usually comes either before the other two kick in, or after they've failed to work.

"It's kind of like we basically said, OK, I cannot fight it, I cannot run away, I just freeze," Romo said. "I just go into this state of, I cannot move, I just stay here."

The general wisdom used to be that freeze was your body giving up. But more recent scientific studies show that's not the case, Romo said.

"We kind of go into perceiving more about the environment, so that we can plan and we can move into action," Romo said.

You may freeze so that your brain can stall for time, taking in more of your surroundings and deciding whether fight or flight will work better. You might also freeze after fight or flight stopped working, to buy time until the threat goes away, or there's an opening to act again.

All three are involuntary, instinctual responses, and everyone is capable of each response. They're also primal, and come from times when ancient humans faced more physical danger on a daily basis.

That's part of why your brain and body react so quickly, before you can think too hard about it.

"This is about survival," Romo said. "Without these responses, our species would have disappeared. So these are very very automatic responses. We cannot control how we feel in that sense."

Anxiety is a 'permanent state of fear'

Having chronic anxiety isn't quite the same as watching a scary movie or getting jumpscared at a haunted house.

But on a physiological level, they're pretty close, Romo said, with "our heart pounding, sweating, you know -- fight or flight."

But getting scared once by a loud noise or something jumping at you "is more immediate," and biological, she said. "Whereas with anxiety, it is more reaction to our emotions."

Someone with anxiety, in a situation that isn't dangerous, might be hyperaware to "the possibility of danger," looking out for factors that remind them of previous threats or problems, Romo said.

If that sympathetic nervous system response is active a lot over a long period of time, "we see that amygdala, for example, gets bigger, and that the stress hormones are kind of released all the time," leading to chronic anxiety and "this state of alertness."

"And so now [the anxious person is] in a permanent state of fear," Romo said, instead of a temporary switch into the sympathetic nervous system, before the switch is flipped back to the relaxed parasympathetic nervous system.

(Treatments for anxiety can help manage your body and brain's fear response.)

New research explains why some people like "recreational fear." News4's Erika Gonzalez reports.

So if it's all a threat response, why do we like getting scared?

You probably have at least one friend that's a horror movie junkie, ready to play all the creepy video games and drag the group into every haunted house that opens before Halloween. You might even be that friend.

But if getting scared is the body's emergency response, and in the moment it feels terrifying -- why do some people find it fun?

A big part of the fun is that haunted houses, scary movies and the like put fear into a controlled environment, Romo said. You still react to the stress with adrenaline, but you're never in real danger, so there's comfort in staying safe.

And after it's over, you may feel better than before.

"We have seen that ... after it finishes, there is an elevated mood," Romo said. "We feel this excitement. It can be cathartic, and it kind of like purges like bad feelings and anxieties. And so it relieves tension."

So, next time you're so stressed you feel like screaming -- that might be exactly the response your brain and body need to feel like the threat has passed.

Contact Us