Soon after he steps off the train at Hogwarts School for Witchcraft and Wizardry, Harry Potter participates in a magical rite of passage: the sorting ceremony. The Sorting Hat matches students to one of the school's four houses based on certain characteristics—Gryffindors are brave, Ravenclaws are smart, Hufflepuffs are nice, and Slytherins are cunning. Fans of Harry Potter can take the sorting quiz online at Pottermore to learn where they’d land if they attended Hogwarts.

While the Sorting Hat accurately evaluates students based on their personalities, it turns out the quiz is almost as correct in real life. A new study finds that people who took the quiz possess traits consistent with the hallmark qualities of the house they sort into. 

“When Rowling developed the official quiz, I was curious to learn what it really measured, if anything,” writes Laura C. Crysel, an assistant professor of psychology at Stetson University (and a Gryffindor).

To determine whether the quiz results corresponded with participants' personalities, Crysel and her colleagues asked 236 people who had taken the quiz what results they received and whether they were happy with them. Then participants then completed a series of tests, which measured the "big five" personality traits—openness, conscientiousness, extraversion, agreeableness, and neuroticism—and the "dark triad"—narcissism, Machiavellianism, and psychopathy. People also answered questions to determine how much they desired knowledge and how much they wanted to fit in with others. 

They found that in most cases, the sorting hat was right: people’s houses matched their personalities. 

“We did find some similarities between the sorting results and the personality measures. For example, Hufflepuffs reported higher agreeableness, Ravenclaws reported higher need for cognition, and Slytherins reported higher narcissism, Machiavellianism, and psychopathy,” Crysel told mental_floss

What’s more, the researchers found that only about half of the participants sorted into the house that they wanted. This means Pottermore’s sorting is better than chance. It also indicates that people can’t manipulate the quiz to get into their preferred house.

“I think this suggests that the quiz may be telling people something real about who they are, if only a little bit,” says Crysel.

Interestingly, Gryffindors did not score highly in extraversion and openness, which the researchers assumed would correlate with their penchant for bravery. Crysel says that Gryffindors didn’t have a direct personality match because there is no measure for bravery. And, more people want to be in Gryffindor—Harry's house—than actually placed there; she suspects those aspiring Gryffindors might be more extroverted than people who sort into the house.

While this might simply seem a fun exercise examining an online personality quiz, Crysel believes that the study reveals that people might use fictional characters as role models.

“People may be using fictional groups to describe and form their identity,” she says. “To a certain extent, our participants may have been reporting the traits that would allow them to fit in with their perception of a fictional group.”

Crysel says it’s important to remember that people ranked themselves. “Slytherin participants chose to rate themselves higher in these traits—we did not assign that rating to them. Also, while some of these traits have negative connotations, they can be used for good,” she says. “More importantly, these are average differences, so no one should expect they will apply to everyone. Like Harry, I think we are all entitled to choose our House, if we wish to do so.”