It’s an eerie feeling: You walk into a place you know you’ve never been before but are overwhelmed by a sense of familiarity—a memory you can’t quite reach. Has this all happened before?

Most people experience this sensation, known as déjà vu, at some point in their lives. It’s a hard feeling to study, though, because it tends to arise spontaneously and be shaken off easily, scientists say. Re-creating it on command in a laboratory is tricky business.

Nevertheless, scientists think that déjà vu actually provides a peek into how the memory system works when it goes a little off-kilter. The feeling may arise when parts of your brain that recognize familiar situations get activated inappropriately, says Akira Robert O’Connor, a cognitive psychologist at the University of St. Andrews in Scotland, who researches déjà vu. When this happens, another region of the brain then checks this feeling of familiarity against your recall of past experiences. When no actual matches are found, the result is a discomfiting sense of having seen it all before, accompanied by the knowledge that you haven’t.

“You get this: ‘Huh, weird, all of these experiences I’m having don’t quite match up.’ So it’s at that stage that you realize that you’ve made an error,” O’Connor says, “which is why it feels like an error, even though it’s probably actually the avoidance of an error.”

In some people with dementia, this feeling of familiarity occurs without the recognition of an error, he says. In those cases, people may go about their business as if they actually have seen it all before, complaining that every show on television is a rerun or refusing to visit the doctor because they’re sure they already have.

Déjà vu means “already seen” in French, a term possibly coined by French philosopher Émile Boirac in a letter to the editor of Revue Philosophique de la France et de l'Étranger in 1876. Boirac speculated that perhaps residues of long-forgotten perceptions triggered the feeling. There is now some laboratory evidence that vague similarities between one scene and another can indeed lead to déjà vu. Cognitive psychologist Anne Cleary of Colorado State University and her colleagues have developed a way to spark it in the lab by showing participants virtual scenes that have some subtle similarities to one another, such as the placement of the furniture relative to a painting on the wall. In a 2009 study, the researchers found that viewing these sneakily similar scenes was more likely to cause feelings of déjà vu than viewing dissimilar scenes—suggesting that perhaps there is some environmental trigger for the brain to call out, “Hey, I recognize that!” even when it’s never seen the scene before.

While Cleary’s research shows that a slight familiarity can result in déjà vu, it’s not clear that true familiarity is necessary to kick off the sensation. “Those sorts of ideas make a fair amount of sense,” O’Connor says, “but we’re actually really good at telling apart very similar things.”

In spontaneous déjà vu cases, he says, it’s quite possible that the familiarity feeling is random. At times, the part of the brain responsible for detecting familiarity—the medial temporal lobe, which is located just behind your temple and plays a large role in encoding and retrieving memories—may fire off overenthusiastically for no particular reason, O’Connor says. Supporting this random-misfire hypothesis is the fact that young people actually experience more déjà vu than older people. Younger brains are a little more excitable, prone to fire more quickly rather than holding back, O’Connor says.

Older people may also be less adept fact-checkers when false feelings of familiarity arise, says Chris Moulin, a cognitive neuropsychologist at the Grenoble Alpes University in France, who studies déjà vu. The fact-checker of the brain sits in the frontal cortex, behind the forehead. In older adults, this region may be less likely to put the brakes on a false sense of familiarity.

Older adults still recognize such false familiarity. “It’s not perhaps that older adults are not generating false familiarity,” Moulin says. ”It’s just that they don’t have, anymore, that certainty that what they’re experiencing is false.”

This is a normal part of aging, not the conflation of déjà vu with reality that people with dementia may experience. So enjoy the feeling of having felt it all before while it lasts, Generation Z. “As I age, it’s disappointing to me,” Moulin says, “because I used to have much more déjà vu than I have now.”