The Sorting is a ceremony that takes place at the beginning of a school year at Hogwarts. The new first-year students that arrive are brought into the Great Hall after the rest of the students are already there. The Sorting Hat is set out on a stool in front of them, and sings a song where it lays out the criteria of each house. Their names are called in alphabetical order, and one by one they try on the Sorting Hat.

The Hat examines the mind of each student, trying to determine which house he or she belongs in. Sometimes it makes its decision quickly, and sometimes it takes longer to deliberate; it can communicate with the student directly, and can be affected by the student's own choices in ambiguous cases. Then the student takes a seat at the table that has been chosen for him or her.