In fiction, only women write fan fiction, and the majority of these are teenagers. In addition, their work tends to contain boatloads of Shipping, Mary Sues, and Ikea Erotica.
This trope has been in effect since well before the internet made it much easier to proliferate fanfic. Studies of early Star Trek fanfiction showed as many as 90% of authors were female in the 1970s, even though at the time such stories could only be shared through fanzines or through sending self-addressed-stamped-envelopes to the authors and having them mail you a manuscript. Various theories abound as to why this trope has persisted so promiently, but the cause is most likely related to the theory that most visual porn is male-oriented (see: any adult video store or site) while most written porn is female-orientednote Although you may be disappointed if you peruse the Erotica section of your local book store thinking that this theory is true for the majority, and Fanfiction, like porn, trades heavily in Author Appeal. This trope is extremely common regardless of the reasoning behind it.
Also a reason why Rape Is a Special Kind of Evil is frequently in play throughout fanfics intended for mature audiences (i.e. in fandoms with multiple villains, rape will frequently be one of, if not the, key issue that divides the invoker of Even Evil Has Standards from the Complete Monster).
This phenomenon has been subjected to academic analysis by ethnographer Camille Bacon-Smith and MIT's Henry Jenkins. Jenkins suggests in Textual Poachers that fanfiction is a reaction on the part of a female audience trying to find their own pleasures in media that caters mostly tomales.
See also Shipping, Slash Fic, Everyone Is Gay, Estrogen Brigade, Het is Ew, Mary Sue. Compare Most Writers Are Male and Most Tropers Are Young Nerds. Combine with The Internet Is for Porn to get All Women Are Lustful.
Creates a paradox when faced with the trope There Are No Girls on the Internet.
Only examples where a character in the work writes a fanfic are to be added. Parodies and deconstructions should not be added.
Genshiken: Ogiue also draws YaoiDoujinshi, much to the great trouble of her Editor boyfriend who is...not a fan. Well, Sasahara gets the appeal of yaoi to her... it's just more than a little awkward when she draws him and ships him with one of his best friends. Other than being featured himself, he's surprisingly accepting.
Darker Than Black had an entire OVA episode devoted to a character who writes in-universe slash fanfics about the protagonist.
Nobuko Yokokawa of Ojamajo Doremi writes stories loosely based on her friends and classmates with her best friend Aiko she idolizes as the Mary Sue protagonist in most of them. Later joined by the shy artist girl Miho Maruyama, who starts creating similar comics with her. With their stories involving romantic plots with their own self-insert characters along with Aiko's, it results in awkwardly heavy doses of Les Yay for a kids' anime.
The new Ms. Marvel, Kamala Khan, writes Avengers and X-Men fanfics. Specifically, about the Avengers' adventures on "Planet Unicorn", and Wolverine's and Storm's in space (where they fight worm hole farting monsters for example).
Averted in Loki: Agent Of Asgard where Loki himself admits he writes and publishes fan fics online. Slash fan fics. Which are apparently "the most horrible slash upon the Internet".
This trope forms part of the main plot in Rainbow Rowell's YA novel Fangirl.
Supernatural has an entire in-universe slash fandom, implied to be primarily female, writing about the show's main characters. The show also features a female slash fic writer as a recurring character, with serious stalking tendency.
In the season two Psych episode with the case at the school for smart kids, one of the (male) students says to Shawn:
Student: Any leads? I'm adapting this into a Nancy Drew fanfic.
Inverted with Glee; Sandy openly admits to writing fanfiction.
In Degrassi: The Next Generation, Clare starts writing Mary Sue fanfic based on a fictional vampire book series called Fortnight.
In an episode of Monk, Monk's self-proclaimed biggest fan asks him why doesn't he use his gun during a case. When he tells her that he doesn't carry one, she remembers that she made that detail up in a fanfic she wrote about him.
In Dragon Age II, Isabela writes "friend fiction". We only get to hear a bit featuring Aveline and Donnic but according to Isabela, she does it for everyone.
However, she does it only as a fan of Varric, who is also a professional writer, who uses his friends as thinly veiled "inspirations" all the time.
In the Fable III side quest, The Pen is Mightier, one of the books is entitled The Pangs of Sunset. It is essentially just an erotic novel featuring the Heros from the previous game. It is implied to contain both Slash and Femslash and is written by a woman named Ilona Pureheart
Garnet and Gure features this strip, wherein the largely female culture of fanfiction is explained.
Questionable Content features two female fanfic writers, Tai and Marigold; Tai's stuff is apparently good (she writes a raved about Harry Potter piece), Marigold's, not so much. After a near miss where lesbian Tai hits on straight Marigold, the latter seeks to make up for the awkwardness by posting a story to Tai wherein Hermione and Ginny "go all the way."
In Homestuck, the female Cherub Calliope (UranianUmbra) admits to writing fanfic about the Alpha Kids.
Vriska has a diary from her ancestor who she strives to emulate, the notorious pirate Marquise Spineret Mindfang, who writes in an overwrought, awkwardly sexual, fanfiction-like style. When we meet Mindfang's alternate universe self, she is a fanfic writer. We also discover Meulin, who writes 'friendfic' speculating on ships.