- Canon is the rules by which we live, the books, the plotlines, the story. Canon is what makes us, protects us, and what as a fanwriter you must respect. Our Canon maintains us, and holds our world together.
- —James Potter, "The Hogwarts Fanfiction Academy," Chapter 22
Canon refers to the characteristics of a particular book, movie, TV show, etc., that make up a plot continuum, as opposed to fanon. Canon can also mean the works themselves. For example, the Harry Potter canon, which is one of the simpler examples, is the seven novels and two shorter books by J.K. Rowling. Harry, Ron, Hermione, Snape, and the other characters in the books are called canon characters or sometimes just "canons."
The issue of what is and isn't canon is sometimes quite complicated. For example, different books in a series can contradict each other, usually by accident. There are also works that are questionably canon, like interviews with authors. Movies that are based on books can also be a problem, because a lot of movieverse fanfiction may be written, and people have to decide if the movies make up their own canon. Things that are canon can even stop being canon.
When things get really confusing, fans often postulate that there are several alternate continuities. For instance, the Marvel Universe (referred to as Universe 616) is generally accepted to be one canon – if Wolverine states in an issue of X-Men that he likes mint chocolate-chip ice cream, it will be taken as read that when he is missing in the next issue because he's gone to a Dairy Queen with the Runaways, he'll be buying mint chocolate-chip ice cream. However, Ultimate Marvel is considered a different continuity from Universe 616, so in Ultimate Marvel, Wolverine's favourite flavour of ice cream may be macadamia. This sort of justification is useful when a franchise has many different shows made by different people (e.g. Transformers).
It is generally agreed that fanfiction and most fans opinions are not canon, although sometimes canon is influenced by popular fanon. For instance, in My Little Pony: Friendship Is Magic, a minor background character who was once accidentally rendered with crossed eyes was nicknamed Derpy Hooves by MLP fans and became popular in the fandom. In response, the show's creators eventually gave her a speaking role.