Muggles' Guide to Harry Potter/Characters/Sorting Hat

Overview
The Sorting Hat is described as being very old and patched. When the hat is put on the head of a Hogwarts new arrival, a mouth forms at the brim, and the hat states, for all to hear, which of the four school Houses the child wearing it belongs in: Gryffindor, Hufflepuff, Ravenclaw, or Slytherin.

The Sorting Hat also sings a song for all of the Hogwarts students and staff before the beginning-of-the-year feast, describing its job and the four Hogwarts houses. However, when the wizarding world or the school is in any imminent danger, the hat will also sing about the importance of the four houses standing together as brothers and sisters in the fight against evil.

The Sorting Hat's unusual qualities are due to the fact that Godric Gryffindor, one of the four Hogwarts founders, owned the hat, and knowing that he would not be around to select houses for the incoming students forever, placed a charm on it to do its job.

Philosopher's Stone
In this book, the Sorting Hat was introduced as the means through which students are sorted into their respective houses.

Having sung its song, it was then placed on the head of each of the first-year students in turn. It then assigned each to a house. The Hat initially though that Harry would do well in Slytherin, but Harry told it that he didn't want to go to Slytherin. The hat then placed him in Gryffindor.

Chamber of Secrets
Because they were unable to make it onto the Hogwarts Express, Harry and Ron are still outside the school when the Sorting commences. They see some of the Sorting proceeding through the window of the Great Hall, but are not present for the Sorting Hat's song.

Later in the book, where Harry is summoned to Professor Dumbledore's office, he finds himself alone in the office with the Sorting Hat and decides to see if the Hat had had second thoughts about his Sorting. The Sorting Hat tells Harry again that he would have been great in Slytherin; Harry disagrees rather forcefully.

In the climactic battle against the Monster in the chamber, Fawkes the phoenix drops the Sorting Hat at Harry's feet; Harry thinks this is useless, though he wears it in hopes that it might afford him some protection or at least counsel; and it shortly thereafter presents him with a sword. Harry uses the sword to kill the basilisk (the Monster).

Harry, having told all this to Professor Dumbledore, tells Dumbledore that the Sorting Hat had originally wanted to place Harry in Slytherin. Dumbledore asks Harry why it did not; Harry says that he had asked it not to. Dumbledore points out that "it is our choices, Harry, that show what we truly are, far more than our abilities." Dumbledore then tells Harry that if he still wonders, he should examine the sword. Harry finds that it is the sword of Godric Gryffindor. Dumbledore tells him that only a true Gryffindor could have pulled that sword out of the Hat.

Prisoner of Azkaban
News that Harry had reacted strongly to the Dementor had been sent to the school by Owl ahead of time, so Harry is taken aside into Professor McGonagall's office so he can be checked over by Madam Pomfrey. Professor McGonagall also wants a word with Hermione Granger and so draws her aside as well. As a result, when Harry reaches the Great Hall, the Sorting is finished, and all we see of the Sorting Hat is Professor Flitwick removing it and its three-legged stool from the stage.

Goblet of Fire
Before the Sorting, the Hat again sings a song about the history of Hogwarts. Harry notes that it is a different song than the one he had heard his first year there, and Ron says that it is a different song every year. Being a hat, it can't have much to do most of the time, and so Ron surmises that it has a lot of time to make up its song.

Order of the Phoenix
Prior to the Sorting, the Hat sings a very much longer song than usual, specifically going into the history of Hogwarts and its founders, and the divisiveness that resulted. It ends with a plea for the four houses to work together in this time of trouble. Ron asks Nearly Headless Nick if the Hat has been known to sing in support of unity, and Nick replies that it has done so quite often, though he is interrupted by the Sorting. Once all the students have been Sorted, he continues that the Hat, being in the Headmaster's office almost all of the time, is aware of what is happening in the school and things that affect the school, and if it sees a problem will try, as best it can, to draw attention to it.

Half-Blood Prince
Due to the argument with Draco Malfoy on the Hogwarts Express, Harry arrives at the feast not only after the Sorting, but largely after the Feast has finished. As a result, we do not see the Sorting Hat at all in this book, except in passing when Harry, visiting the Headmaster's office, notices it sitting quietly on the shelf.

Deathly Hallows
In Severus Snape's memories, we see the Sorting Hat as it Sorts Lily Evans, Peter Pettigrew, and James Potter into Gryffindor, and Snape into Slytherin.

At the Battle of Hogwarts, Neville Longbottom is forced by Voldemort to wear the Sorting Hat. Voldemort then sets Neville on fire, but Neville is unhurt by Voldemort's curse, and pulls the Sword of Gryffindor from the Sorting Hat, just as Harry did in the Chamber of Secrets. Neville then kills Voldemort's snake Nagini, the last of Voldemort's Horcruxes, making it possible for Voldemort to later die from his own reflected killing curse.

In the Epilogue the Sorting Hat is mentioned, still doing its job at Hogwarts 19 years later. Harry here tells his son, Albus Severus, that he had asked the Hat not to put him in Slytherin, and it had placed him in Gryffindor instead.

Strengths
The Sorting Hat's annual song reflects the issues and concerns of current events. This implies that the hat has some ability, possibly through listening to passing events in the Headmaster's office, to keep up with the changes and threats to Hogwarts, and sufficient consciousness to understand them.

Weaknesses
It is just a hat, and has only a certain amount of "mind-reading" ability and the power of speech. It cannot move, it can influence events around it only by persuasion, and apparently spends most of its time on a shelf in the headmaster's office.

Relationships with Other Characters
The Sorting Hat is designed to act as a proxy for Godric Gryffindor in selecting Houses in the school for students. As such, Gryffindor must have imbued it with some of his own abilities in that regard, and apparently with some rudimentary consciousness.

It is uncertain how it relates to other characters, as the only time we see it responding to other characters is when it is actually physically placed on a character's head. Its being able to sing before the Sorting begins would suggest that it can communicate; we do not choose to speculate as to why it does not. Ron seems to believe that it can hear and understand conversations proceeding in the Headmaster's office, but we never see it responding to the passing scene while it is sitting on the shelf there; the only time we hear it speak is at the Sorting, and when Harry has it on his head.

Analysis
It is clear that the Hat has some level of consciousness; we hear that its song is different every year, and that its song reflects the need to deal with threats against Hogwarts. It also engages in conversation with Harry on two occasions, first when Harry is initially Sorted in Harry Potter and the Philosopher's Stone, and later when Harry dons the Hat in the Headmaster's office in Harry Potter and the Chamber of Secrets. This is why the Hat is listed as a character, rather than as a magical artifact, in this guide. It is also, probably, why Professor Dumbledore says that the Sword of Gryffindor is the only known artifact of Godric Gryffindor; the Sorting Hat was clearly a possession of his, but its consciousness makes it not an artifact but a person.

The Sorting Hat has an apparent affinity for the Sword of Gryffindor, as we see it produce the sword twice during the series; possibly this affinity comes from the fact that both were the property of Godric Gryffindor, and he may have established that particular affinity himself. It also seems the Hat is capable of retrieving the Sword from anywhere, because Griphook the goblin had taken it when Harry, Ron, and Hermione raided Gringotts. Theoretically the sword should have remained in the possession of the Goblins, as Griphook had returned to his old employers at Gringotts, but the Sorting Hat still manages to provide it to Neville at need.