There are hundreds of thousands of Harry Potter stories written by fans. I wanted to know how they compared to the original series, so I took a look at story data from one of the internet's biggest fandom sites.
To set the scene, here's a picture of all relationships from the seven original Harry Potter books by J. K. Rowling. Each circle is a character, colored male or female, with lines indicating romantic pairings.
Lines are colored by whether the relationship is straight, male-male, or female-female.
In the original series there's only one same-sex relationship (between Albus Dumbledore and Gellert Grindelwald) and even that one was only obliquely alluded to in the original books.
In fanfic, things look very different.
Here's the same chart, now with lines connecting characters who are romantically linked in fanfiction, and with the popularity of the relationship represented by the thickness of the line.
Click a character to see only their relationships.
Well, that look different! A lot more diversity across the board, but in particular there's a huge increase same-sex pairings.
Some characters, like Hermione, are still mostly straight in fanfic romance stories. Others, like Sirius Black, have a much higher proportion of same-sex relationships.
We can make a chart that plots this data to find the “gayest” and “straightest” characters in fanfic — those with the highest or lowest fraction of same-sex relationships. This time we'll include all characters who went to Hogwarts and sort them by house.
In the picture below, each circle is a character, sized by popularity and positioned on a scale from 0% to 100% based on the percentage of their relationships that are with characters of the same sex.
Female characters are less likely to feature in same-sex relationships than male characters, and while some of the popular Gryffindors are up there, the cluster of Hermione, Ginny, and James & Lily Potter near zero balance out the score for Gryffindors.
Slytherin on the other hand has very few characters at the low end of the scale. At the same time, the most popular Slytherins, particularly Draco, Snape, and Voldemort, score highly.
So, what's the gayest house?
Looking at the percentage of same-sex relationships by house, the conclusion is clear: the gayest Hogwarts house is Slytherin. 🐍 🏠 🌈
This stays the case if we look at character-level means or medians by house or even remove a popular character or two, since characters have relationships across houses.
If we limit our analysis to male characters only, things look different: Gryffindor places first, followed in order by Ravenclaw, Slytherin, and Hufflepuff. You can see for yourself by clicking these links to transfigure the chart above: male only, female only, or both.
To round this out here's the chart for everyone else who didn't go to Hogwarts:
Tune in next time when we explore the giant squid. 🦑
You can return home or see the code.
Thanks to Yuriy Rusko, Zora Killpack, Mitha Nandagopalan, Ben Kuhn, Ben Cartwright-Cox, Julie Cris, Anthony Vastano, Moritz Stefaner, and Dan Luu for comments on drafts of this post and help with research.
Here's an overview of the analysis behind this post. You can find the full analysis and dataset here.
The data in this post is derived from all Harry Potter fan works published on fanfiction.net over the course of 16 years, from 1999 to early November 2016 (which is when I gathered it):
Works are written in 42 languages, with most written in English (79%), Spanish (7%), French (7%), Portugese (3%), and German (2%).
Each work has metadata indicating up to two genres. Most works are in the Romance genre:
Works are also tagged with pairings and main characters.
Since the true rate of romantic relationships is much higher than 4%, I enriched the provided pairings with additional character pairs from Romance works that had no pairings and exactly two characters. Spot checks confirmed that this picks up romances where where authors listed characters but failed to add the pairing.
Some of the pairings were between more than two characters: 789 works listed three characters and 227 listed four. For the purposes of the analysis each of these pairings is treated as representing multiple individual relationships. E.g. a pairing between characters a, b, and c would contribute relationships (a, b), (b, c)., and (a, c). This resulted in 346,378 relationships.
For computing same-sex proportions the basic unit of analysis is a single character in a relationship; each relationship contributes two such data points. For example, there are 48,081 relationships between Hermione Granger and Draco Malfoy. This turns into two data points, one for Hermione and one for Draco:
{char: "Hermione G.", otherChar: "Draco M.", sameSex: false, count: 48081}
{char: "Draco M.", otherChar: "Hermione G.", sameSex: false, count: 48081}
We exclude the special OC character from this analysis since their gender is not well-specified in the tagging system (20,602 relationships), and include as having no sex the Giant Squid, Dementors, Sorting Hat, Basilisk, Mirror of Erised, and Whomping Willow (70 relationships).
The same-sex score for a character is computed by summing together the number of same-sex relationships that character has and dividing by their total number of non-OC relationships. The score for a Hogwarts house is computed the same way, but across all characters in that house.
This post has a generous concept of canon relationships which encompasses everything from marriages to halfhearted dates, such as the relationship between Hermione and Cormac McLaggen, who Hermione spent most of her time avoiding.
For students, their house is the one they were sorted into. For adults, their house is the house they were in at Hogwarts or are most closely affliated with (e.g. Slytherin for Snape), or blank if none or uncertain (e.g. Frank Longbottom, who is Neville's father, and Rabastan Lestrange, who is Bellatrix's brother-in-law).
Not all characters are represented as their canon gender in fanfiction (e.g. a story could be about female version of Draco). This post assumes that the proportion of such stories is low.
Here are the same-sex scores by Hogwarts house. Here's the chart using the definition in the post:
Here's the score by median character:
By mean character:
Percentage scores for male characters only:
Percentage scores for female characters only:
Here are the percentage scores for the top 50 most popular characters: