It happens in an instant just before you fall asleep. You’re startled by a loud noise — the thud of a book slamming to the floor, or worse, the bang of a shotgun nearby. You a jump up and look around, but everything seems normal. Well it is, but you did hear a noise that wasn’t real. It was in your brain.

It’s a phenomenon called “exploding head syndrome.”

“It can sound like explosions, gunshots in your head, giant guitar strings breaking beside you or something heavy being dropped,” Brian Sharpless, assistant professor and director of the psychology clinic at Washington State University, told The Washington Post. He’s also the lead author of a study on the disorder. “A small number of people will see lightning, flashes of light or visual static like you see on a TV screen. It’s scary, and people wake up confused.”

Exploding head syndrome has received little clinical attention over the years. Scientists have hypothesized the condition is rare and seen mostly in people older than 50. But when Sharpless and his researchers assessed 211 undergraduate students for sleep paralysis as well as exploding head syndrome — which appear to be connected — they found the phenomenon is more common than clinic lore led them to believe. The researchers recently published the findings in the Journal of Sleep Research.

Its symptoms were first described some 150 years ago. Doctors have noted it in literature as “sensory discharges” and, later, “snapping in the brain.” In 1988, neurologist J.M.S. Pearce dubbed it “exploding head syndrome.”

Sharpless and his colleagues found that 18 percent of the people they interviewed had experienced the disorder at least once. More than 16 percent had recurring cases. However, when the researchers removed those who had also experienced sleep paralysis, the number fell to 13.5 percent — which is still “shockingly high,” he said.

The sensation occurs during “sleep state misperception,” the moment right before people doze off, though it can also happen as they are waking up.

“Your brain essentially has a hiccup in the reticular formation, which is the part of the brain that helps shut down your body for sleep,” Sharpless said. “It shuts down your motor, visual and auditory neurons. But with exploding head syndrome, instead of the auditory neurons shutting down, they fire all at once.”

That hiccup can make people hear a noise that isn’t there — sometimes in their ears, other times in their heads. In some instances, people have seen lightning or other flashes of light, or felt an intense heat all over, according to Sharpless’s research. But despite how scary the name is, “it’s physically harmless,” he said.

“Some people with exploding head syndrome thought they were having a seizure or a subarachnoid hemorrhage or something really bad,” he said. “There is some evidence that just learning about it can reduce the frequency of the episodes.”

Less than 3 percent of those who had experienced it had it to an extent that it interfered with their lives, according to the research. “If it happens that much, it’s not doing good things for your sleep,” Sharpless said, but that’s about it.

The next phase it to try to understand what might make people more likely to have it.