"Sings a different [song] every year. It's got to be a pretty boring life, hasn't it, being a hat? I suppose it spends all year making up the next one."
-- Ron Weasley
Originally the pointed wizard’s hat of Godric Gryffindor, the Sorting Hat was bewitched by all four of the founders of Hogwarts with brains and some amount of personality. Its function is to determine which of the four Houses each new student will enter. It does so at the beginning of the start-of-term feast, when it is placed on a three-legged (sometimes four-legged) stool in front of the Great Hall. It then sings a long, rambling song of introduction, a different one each year but with the same basic information in it: how it was bewitched to perform the sorting and what the criteria are for the various houses. The first year students one by one place the Sorting Hat on their heads. Within a minute, it loudly proclaims the house for which they are best suited.
The hat is battered and old; it’s patched, frayed, and extremely dirty. In order to speak and sing, a tear along the brim opens like a mouth. It speaks inside of the hat with a small, quiet voice to the wearer and it can read thoughts and respond to them. When not sorting students, the Sorting Hat rests on its stool in Dumbledore’s office.
The Sorting Hat can also function as a portal to provide access to the Sword of Gryffindor to a Gryffindor who wears the hat and seeks help (Pm).
According to Nearly-Headless Nick, who’s been around a long time as the Gryffindor House ghost, the Sorting Hat feels itself honor-bound to give due warning when it detects great danger for the school. Nick says he’s heard it happen several times before, and that the advice is always the same: “Stand together, be strong from within (OP11).”
In 1991, the Sorting Hat's song went like this (PS7):
Oh you may not think me pretty,
But don't judge on what you see,
I'll eat myself if you can find
A smarter hat than me.
You can keep your bowlers black,
Your top hats sleek and tall,
For I'm the Hogwarts Sorting Hat
And I can cap them all.
There's nothing hidden in your head
The Sorting Hat can't see,
So try me on and I will tell you
Where you ought to be.
You might belong in Gryffindor,
Where dwell the brave at heart,
Their daring, nerve, and chivalry
Set Gryffindors apart;
You might belong in Hufflepuff,
Where they are just and loyal,
Those patient Hufflepuffs are true
And unafraid of toil;
Or yet in wise old Ravenclaw,
if you've a ready mind,
Where those of wit and learning,
Will always find their kind;
Or perhaps in Slytherin
You'll make your real friends,
Those cunning folks use any means
To achieve their ends.
So put me on! Don't be afraid!
And don't get in a flap!
You're in safe hands (though I have none)
For I'm a Thinking Cap!
In 1994, the Sorting Hat's song went like this:
A thousand years or more ago
when I was newly sewn,
there lived four wizards of renown,
whose names are still well known:
bold Gryffindor, from wild moor,
fair Ravenclaw, from glen,
sweet Hufflepuff, from valley broad,
shrewd Slytherin, from fen.
They shared a wish, a hope, a dream,
they hatched a daring plan
to educate young sorcerers
thus Hogwarts School began.
Now each of these four founders
formed their own house, for each
did value different virtues
in the ones they had to teach.
By Gryffindor, the bravest were
Prized far beyond the rest;
For Ravenclaw, the cleverest
would always be the best;
For Hufflepuff, hard workers were
Most worthy of admission;
And power-hungry Slytherin
loved those of great ambition.
While still alive they did divide
Their favorites from the throng,
Yet how to pick the worthy ones
When they were dead and gone?
'Twas Gryffindor who found the way,
He whipped me off his head
The founders put some brains in me
So I could choose instead!
Now slip me snug about your ears,
I've never yet been wrong,
I'll have a look inside your mind
And tell where you belong!
In 1995, the Sorting Hat's song went like this (OP11):
In times of old, when I was new,
And Hogwarts barely started,
The founders of our noble school
Thought never to be parted.
United by a common goal,
They had the selfsame yearning
To make the world's best magic school
And pass along their learning.
"Together we will build and teach"
The four good friends decided.
And never did they dream that they
Might some day be divided.
For were there such friends anywhere
As Slytherin and Gryffindor?
Unless it was the second pair
Unless it was the second pair
Of Hufflepuff and Ravenclaw,
So how could it have gone so wrong?
How could such friendships fail?
Why, I was there, so I can tell
The whole sad, sorry tale.
Said Slytherin, "We'll teach just those
Whose ancestry's purest."
Said Ravenclaw, "We'll teach those whose
Intelligence is surest"
Said Gryffindor, "We'll teach all those
With brave deeds to their name."
Said Hufflepuff, "I'll teach the lot
And treat them just the same."
These differences caused little strife
When first they came to light.
For each of the four founders had
A house in which they might
Take only those they wanted, so,
For instance, Slytherin
Took only pure-blood wizards
Of great cunning just like him.
And only those of sharpest mind
Were taught by Ravenclaw
While the bravest and the boldest
Went to daring Gryffindor.
Good Hufflepuff, she took the rest
and taught them all she knew,
Thus, the Houses and their founders
Maintained friendships firm and true.
So Hogwarts worked in harmony
for several happy years,
but then discord crept among us
feeding on our faults and fears.
The Houses that, like pillars four
had once held up our school
now turned upon each other and
divided, sought to rule.
And for a while it seemed the school
must meet an early end.
what with dueling and with fighting
and the clash of friend on friend.
And at last there came a morning
when old Slytherin departed
and though the fighting then died out
he left us quite downhearted.
And never since the founders four
were whittled down to three
have the Houses been united
as they once were meant to be.
And now the Sorting Hat is here
and you all know the score:
I sort you into Houses
because that is what I'm for.
But this year I'll go further,
listen closely to my song:
though condemned I am to split you
still I worry that it's wrong,
though I must fulfill my duty
and must quarter every year
still I wonder whether sorting
may not bring the end I fear.
Oh, know the perils, read the signs,
the warning history shows,
for our Hogwarts is in danger
from external, deadly foes
and we must unite inside her
or we'll crumble from within
I have told you, I have warned you...
let the Sorting now begin.
Uses Legilimency to read the minds of students and place them in what it considers to be the correct House (Pm).
The Sorting Hat is one of those slightly unnerving sentient objects in the Harry Potter universe which reveals a person's innermost feelings or thoughts. Fans find these objects fascinating because not only because we want to know our favorite characters better ("What would Snape see in the Mirror?") but also because we want to know how we ourselves would fit into the magical world. So we want to be Sorted, we want to know what wand would choose us, what our Patronus would be, and so on.
Information on the Sorting Hat as a portal comes from the new Pottermore ebook.
There is more to the Sorting Hat than one might think. Rowling said, "There is more to the Sorting Hat than what you have read about in the first three books. Readers will find out what the Sorting Hat becomes as they get into future books" (IP).