How to write a fanfiction
Choose source material to work from. Fanfiction is always based on an existing work of art. You are essentially making a story that expands or otherwise alters existing fiction. The mediums you might choose from are endless. Fanfics have been written about books, movies, television shows, video games, and just about anything else with a narrative base and a fandom to admire it. You should pick a fictional universe you already feel closely to. Common choices for fanfic are Doctor Who, Harry Potter, and a number of anime shows. The choice of universe you choose to base your own work on will have the largest impact on your story and the way it turns out. Certain universes also favour certain approaches in fanfic. It's important to note however that your choices as a fanfic writer are limitless. You can do anything you want to the source material, even if that means transforming it into something else entirely.
Read up on the fictional universe. Most fanfiction tends to be based on a science-fiction or fantasy-themed universe, like Harry Potter or Supernatural. These are great to base fanfics off of because they offer huge universes with an endless amount of storytelling potential. Look online and read up everything you can about the given universe. Even if you're planning on breaking free of the established canon with your fanfic, it helps a lot to know the rules before you break them.
Read some fanfiction. The best ideas you'll get for your work will be inspired from the source material itself. With that said, it still helps to see what other fans have done with the same ideas. Using a website like Fanfiction.net, take a look through some fanfiction that matches your on source material. Read some stories people have written. Most importantly, get a grasp of the ways in which people use and adapt the source. In looking for fanfiction to read, you may get the looming impression that a lot of fanfiction lacks for quality. Being part of the fanfic community means acknowledging that not everyone is at the same level of skill. Most fanfiction is amateurish, and a lot of it frankly isn't worth reading. It takes patience to find the great stuff.
Determine your scope. Because fanfiction is so diverse and open-ended, it helps to make some rules up for yourself before you go into writing it. Is your story going to be big or small? While some fanfictions can become as long as books, the majority tend to be fairly short. However, there is a lot of debate amongst the community as to how long a perfect fanfic would be. Certain lengths and styles fit topics better than others. In the end, your length will be decided in the actual writing process, but it's a good idea to keep a prospective scope in mind before you put the pieces together. The shortest fanfics are called "drabbles". These are usually between 50-100 words long. It is surprisingly challenging to tell a story in such a small space, so it may be a good place to start if you want to test your skills without the time investment. So-called "fluff" pieces are short and light-hearted. They tend to be less than 1000 words and deal with a mundane aspect of a character's life. More involved fiction can be hundreds of thousands of words long. These tend to be the fanfics that people give most attention to, assuming they're fuelled by a plot that justifies the length. Fanfics don't need to be conventionally narrative or prose either. You can write your fanfic as poetry, or write up a tableau of a character's mental state during a given scene.
Imagine "what-if" scenarios for your source material. All fanfic is based on speculation. Whether you decide to write a sequel for the work or an alternative history, everything is based on that first "what if" question. What if a certain character died (or didn't die) at a certain point in the story? What do you think happens after the credits roll in a movie. These are the sort of questions you should be asking yourself in the early stages of planning a fanfic. Explore the source material more if you are having a hard time finding a creative starting point. Failing that, look into more fanfic. It can be inspiring to see where other people have gone with it. Some writers even write themselves into a fanfic, where they interact with the characters themselves. A character meant as a stand-in for the writer is known as an "avatar".