A version of this post for use by teachers and students can be found here. This version contains some material for adults.
​
Every February, International Fanworks Day celebrates the creativity and passion of fandoms around the world, and there’s no better place to witness this vibrant universe than Archive of Our Own (AO3). AO3 isn’t just a treasure trove of fanfiction, fan art, and transformative works—it’s a fascinating dataset that tells the story of the ways we remix our favorite media. In this post, we’ll explore what the numbers on AO3 can reveal about the evolving world of fanworks. We’ll also look at how data science can be used to explore interesting and unusual data.
​
So what’s a fandom? What’s fanfiction? In a general sense, fandoms are groups of people who love a particular book, movie, TV show, play, musical, celebrity, sports team, fashion, music genre etc. Anyone debating the Game of Thrones ending, going to a Star Trek convention, or even attending the 1893 public demonstrations mourning the death of Sherlock Holmes, is participating in fandom. AO3, a fanworks archive with millions of readers a day, focuses on sharing fanfiction. Fanfiction is any work of fiction based on an existing work of fiction. Fanfiction can be a few sentences to series-length books, and is usually a remix of the original world. Fanfiction writers explore a huge range of topics. This week in my reading, I’ve read stories that put Harry Potter in Slytherin, made Tony Stark (Iron Man) travel back in time to World War Two, and had Sokka and Zuko (Avatar the Last Airbender) co-own a bakery in modern NYC. The possibilities are endless!
​
As a long-time reader and writer of fanfiction — reading about half a million words of fanfiction a week and with almost two million readers of my work — I have a deep love of AO3 and for fanwork in general. I’m excited to deep dive into the data we can grab from AO3!

Largest Fandoms

While some fandoms might have a few hundred works with a couple of comments each, major fandoms can have hundreds of thousands of works, each with thousands of comments and millions (even billions) of readers. The first piece of data analysis we’re going to look at is finding out how many works have been published for each fandom, and then what the largest fandoms are.
Scrape and clean the list of all fandoms for a category (e.g. Movies)
In[]:=
datacleanallworks[string_String]:=<|"Fandom"->First[StringCases[string,fandom___~~"("->fandom]],"Count"->ToExpression[Last[StringCases[string,DigitCharacter..]]]|>​​importandcleanfandomlists[fandomtype_]:=datacleanallworks/@Flatten[Import["https://archiveofourown.org/media/"<>fandomtype<>"/fandoms","Data"][[4,2]]]
Let’s look at how many works have been published for all the Books and Literature, Cartoons, Comics and Graphic Novels, Movies, and TV Shows categories and look at the data in a word cloud. The size of the word will represent how many works are associated with that fandom:
WordCloud for the top ~100 fandoms by size
Out[]=
It’s probably not surprising that the largest fandoms are Marvel and the Marvel Cinematic Universe, Harry Potter, the DC Universe, Supernatural and Star Wars, as these are some of the largest grossing series. We might be surprised that shows like Teen Wolf outperform Game of Thrones (A Song of Ice and Fire & Related Fandoms), though!
Interestingly, there is a huge size discrepancy between fandoms on AO3. We can see from the data that the top few fandoms have half a million or so works, but that quickly drops to under 100,000. At the other end of the dataset, there are thousands of fandoms with just one or two works.
Dataset showing how many fandoms fall into each band by number of works:
Out[]=
1
12529
2
5050
3 to 10
9524
11 to 100
8055
101 to 1000
2686
1001 to 100,000
918
More than 100,000
16
More power to these tiny fandoms and their artists! For the remainder of this blog, we’ll be focusing on some of the largest fandoms.

Tags in a Specific Fandom

A great thing about AO3 is that all works are thoroughly tagged by their authors to facilitate searching. Tags are in four categories: Archive Warnings, Relationships, Characters, and Freeform tags. Archive Warnings indicate any triggering content, like “Graphic Descriptions of Violence”. Relationship tags show romantic or non-romantic relationships in the work, and Character tags are the characters which appear in the work. Freeform tags allow the author to tag any content which appears in their work. Freeform tags are often tropes, settings, or comments about the story.
Let’s dive into the Harry Potter fandom, since that’s likely to be familiar to most of us. For this, we’ll be looking at the most common tags, rather than the most read or the most liked.
Scrape, clean and split the 1000 most used tags from a specific fandom
findtags[fandom_String]:=Flatten[Import["https://archiveofourown.org/tags/search?commit=Search+Tags&page="<>#<>"&tag_search%5Bcanonical%5D=T&tag_search%5Bfandoms%5D="<>fandom<>"&tag_search%5Bname%5D=&tag_search%5Bsort_column%5D=uses&tag_search%5Bsort_direction%5D=desc&tag_search%5Btype%5D=","Data"][[4,3]]&/@ToString/@Range[20]]​​dataclean[string_String]:=<|"Type"->First[TextWords[string,1]],"Tag"->StringDrop[First[StringCases[string,": "~~tag___~~"("->tag]],-2],"Count"->ToExpression[Last[StringCases[string,DigitCharacter..]]]|>​​alltagset[tagslist_List]:=Dataset[dataclean[#]&/@tagslist]​​charactertagset[tagslist_List]:=alltagset[tagslist][Select[#Type=="Character"&]]​​relationshipstagset[tagslist_List]:=alltagset[tagslist][Select[#Type=="Relationship"&]]​​freeformtagset[tagslist_List]:=alltagset[tagslist][Select[#Type=="Freeform"&]]
For the Harry Potter fandom:
pottertags=findtags["Harry+Potter+-+J.+K.+Rowling"];​​pottercharacters=charactertagset[pottertags];​​potterrelationships=relationshipstagset[pottertags];​​potterfreeform=freeformtagset[pottertags];

Characters in Harry Potter Fanwork

Let’s look at the characters that appear the most in Harry Potter fanworks.
The top 10 characters in all Harry Potter fanworks:
Take[pottercharacters,10]
Out[]=
Type
Tag
Count
Character
Harry Potter
384715
Character
Hermione Granger
174196
Character
Draco Malfoy
163339
Character
Sirius Black
120954
Character
Ron Weasley
107506
Character
Remus Lupin
107343
Character
Severus Snape
104981
Character
James Potter
81422
Character
Ginny Weasley
64210
Character
Albus Dumbledore
56798
WordCloud showing the frequency of the top 70 most common characters in all Harry Potter fanworks:
Out[]=
We can see here that Harry appears in the most works, followed by Hermionie. Poor Ron comes in fifth. Interestingly, minor characters such as Astoria Greengrass and Evan Rosier appear in similar numbers of works as more major characters such as Arthur Weasley and Rubeus Hagrid.

Relationships in Harry Potter Fanwork

Now we have a grip on what characters appear in Harry Potter fanworks, we can also look at the most used relationship tags. On AO3, romantic relationships are denoted with a “/”, and non-romantic relationships with an “&”
WordCloud showing the frequency of the top 50 most common relationships in all Harry Potter fanworks:
Out[]=
Looks like non-cannon relationships, like Draco and Harry, are the most common, with pretty-much-cannon relationships like Sirius and Remus following close behind, and actual cannon relationships like Hermionie and Ron coming in next. Fandom creators do have fun with the source material.
BarChart showing the frequency of romantic (slash) and platonic (and) relationships in all Harry Potter fanworks:
It also looks like there are more romantic pairings than platonic ones. This doesn’t mean more work has been done for romantic over platonic, just that there are more pairings of that type, but it’s an interesting data-point none the less.

Freeform Tags in Harry Potter Fanwork

Freeform tags allow the author of the work to tell their readers what the work is about or what to expect when reading.
WordCloud showing the frequency of the top 50 most common freeform tags in all Harry Potter fanworks:
Interestingly, it looks like the most common things to write Harry Potter fanwork about include the Marauders Era - the period where Harry’s parents were at school - and after the books end. After the books end includes tags like “Epilogue What Epilogue” (usually fics which ignore the “19 years later” epilogue in the books), “Hogwarts Eighth Year” and “Post-Hogwarts”. My personal favorites are works which are set in an alternate universe (AU). These are often stories which are about the same characters, but put in a different world, or a different version of the cannon world. For example, the “No Voldermort” AU describes stories set in a Harry Potter world without Voldermort.
Frequency of the Alternate Universe tags in all Harry Potter fanwork

Analyzing Popular Works

Now that we’ve explored the most common fandoms and the common tags within those fandoms, let’s take a look at the most popular works. Again, we’ll stick with Harry Potter. We can find a lot of information about the most popular works on AO3 by scraping the archive organized by kudos. Kudos on AO3 is equivalent to likes or star ratings.
Code to get all the information about the most liked 1000 works in the Harry Potter fandom
For each work, we get four key pieces of information:
◼
  • Archive Warnings and Completion Status
  • ◼
  • Tags
  • ◼
  • Archive Warnings
  • ◼
  • Relationships
  • ◼
  • Characters
  • ◼
  • Author tags
  • ◼
  • Series information
  • ◼
  • Basic Statistics
  • ◼
  • Language
  • ◼
  • Word Count
  • ◼
  • Chapter Count
  • ◼
  • Comment Count
  • ◼
  • Kudos Count
  • ◼
  • Bookmarks Count
  • ◼
  • Hits Count
  • This information lets us do all kinds of analysis. For example, we can look at the characters and relationships in the top 1000 works, and we can analyze the basic statistics of all the works.

    Characters and Relationships in the Top 1000 Harry Potter Works

    Let’s look at what characters appear, what characters appear together, and how their relationships are tagged in the top 1000 works.
    Code to isolate the tags list and then the characters from the top 1000 works
    WordCloud of the frequency of character appearances in the top 1000 works
    Similarly to the overall character list - which showed how many times each character appeared at all - the character distribution in the top 1000 features all the main characters, with smaller characters appearing less frequently. Now, though, we can see how characters appear in stories together.
    WordCloud showing how frequently pairs of characters appear in the top 1000 works
    This can help us visualize how characters appear together. A better way to visualize this might be with a graph:
    Code to make rules between relationships and generate a graph - either a normal graph or a CommunityGraphPlot of the relationships
    Graph visualizing the most common 100 relationships between characters in the top 1000 works. Nodes are sized based on how many edges they have.
    We can even visualize these relationships on a CommunityGraphPlot:
    CommunityGraphPlot visualizing the most common 100 relationships between characters in the top 1000 works. Nodes are sized based on how many edges they have.
    We can see in the community graph plot that characters like Remus, Sirius, James, Peter and Lily often appear together, which makes sense, as they are a friendship group. Interestingly, the Weasleys and the Malfoys often appear in the same works despite being rivals. Clearly, we’re aiming for conflict in plots!

    The Most Read Tags

    While we explored the most common tags at the beginning, we can also explore which tags are the most read in the top 1000 works. If we find how many hits (readers) each work has, we can combine that data to find how many hits each tag in the top 1000 works has.
    Code to find the tags and the hits from all works. Also removes archive warnings and NSFW tags:
    WordCloud showing the most widely read tags in the top 1000 works, excluding characters and relationships
    Now we can see what types of works most readers like to read. I’m personally a big fan of Slytherin Harry Potter and Manipulative Albus Dumbledore stories - we love a good character exploration!

    Note on NSFW tags

    I did take the NSFW tags out of this WordCloud for the blog, but given fanfiction’s reputation for being pretty NSFW, I thought I’d do a quick count to see how frequently NSFW tags are read, and while the numbers are large - more than 240 million hits on NSWF tags - that’s a significantly smaller number than the 12 billion on SFW tags! Maybe the reputation is undeserved, at least in the Harry Potter fandom.

    Basic Statistics of the top 1000 works

    We can also look at the basic statistics of each work. Here, we can see how many words each work has and how many chapters it’s split into, how many collections of works the work features in, how many comments a work has, how many kudos it’s gained, how many hits it has, and I also calculated the rate of hits to kudos (readers vs likes).
    Code to parse and clean the basic statistics for a set of works
    Let’s look at the statistics for the top 1000 works
    Dataset showing the words, chapters, collections, comments, kudus, bookmarks, hits and kudos rate for the top 1000 works by kudos:
    We can see that the top few works by kudos are pretty long, so let’s explore that first!
    Code to create a ListPlot between any two variables
    ListPlot showing Kudos vs Words
    Interestingly, it looks like there’s no strong correlation between the length of a work and how much kudos it gets. There are very long works with very few kudos, and very short works with huge amounts of kudos. However, it looks like there is a good concentration in the lower words lower kudos quadrant. Each reader can only give kudos once to a work, no matter how long it is, so perhaps this implies that shorter works are likely to get a lot of kudos and then hit a ceiling, making way for works with high word count to receive a lot of kudos. It also shows that not all really long works are well loved! When I went to have a look at some of the very long fics with low kudos counts, they had some very unusual tags, many of which didn’t even feature in the top 1000, which might explain why they have a low kudos count.
    Let’s explore how hits and kudos are related.
    ListPlot showing Kudos vs Hits
    We can see from this plot that, in general, the more hits a work gets, the more kudos it gets. This makes sense at a fundamental level - clearly, the more people look at something, the more interaction it will get. Interestingly, though, there are lots of outliers, and the correlation gets weaker the higher the hit rate. If you look at the works with 30,000 kudos, they’re pretty evenly spread across the plot for how many hits they got, but at the lower kudos works, they’re much more concentrated at the lower hit rates. Interesting stuff.
    There aren’t many clear correlations between stats, but we can find some. For example, there seems to be a pretty linear relationship between hits and bookmarks. Bookmarks happen at a lower rate than kudos, but demonstrate a reader’s desire to return to the work at a later date. The more people read a work, the more likely they are to want to read it again:
    ListPlot showing Hits vs Bookmarks

    Bonus question: Sexuality in Fanworks

    Fandom has always been a safe place for fans to engage in explorations of relationships and sexualities not explored in cannon. While the top six fandoms on AO3 contain possibly one cannon non-heterosexual relationship, fanworks lean significantly towards the homosexual space. Let’s have a look at the relationship distributions for the top six fandoms: Marvel, Harry Potter, DC Universe, Supernatural, Star Wars and Sherlock Holmes.
    PieCharts showing the distribution of relationship types in the top 6 fandoms
    Overall, the top fandoms are overwhelmingly homosexual or have no relationships at all. Only DCU has a majority heterosexual relationships, despite all the fandoms being overwhelmingly heterosexual in cannon. Overall, AO3 is a pretty great place to hang out with the LGBTQ crowd.

    Conclusions

    Hopefully, you’ve had a great time exploring some fandom data with me! I hope you had a great International Fanworks Day, and I encourage you to check out (or even create) some fanwork for your favorite media! Hopefully this post gives a good starting point for doing your own analysis, and there are so many questions left to explore.

    CITE THIS NOTEBOOK

    Exploring fandom with data​
    by Rory Foulger​
    Wolfram Community, STAFF PICKS, March 6, 2025
    ​https://community.wolfram.com/groups/-/m/t/3411046