The Room of Requirement, also known to the house-elves as the Come and Go Room, is a secret room within Hogwarts whose existence is known only to a select few. To make the room appear, a person must walk past the section of blank wall on the seventh floor three times while concentrating hard on what they need. A door will then materialise. The room's nature is to provide whatever the user requires, with some limitations. It cannot, for instance, create food, as this is one of the five Principal Exceptions to Gamp's Law of Elemental Transfiguration. However, it can provide access to food, as demonstrated when it created a secret passage to the Hog's Head Inn. The magic of the room is highly advanced and seems to be sentient, able to interpret the user's needs with remarkable precision. One of the room's most significant and stable configurations is the Room of Hidden Things. In this form, it appears as a vast, cathedral-sized chamber cluttered with an immense collection of objects hidden by generations of Hogwarts inhabitants. This “room full of junk” contains everything from broken furniture and old potion bottles to forbidden magical artifacts. It was in this form that Tom Riddle hid Rowena Ravenclaw's Diadem, and where Harry Potter later hid his copy of the Advanced Potion-Making textbook. The contents of this version of the room appear to be constant unless an item is physically removed or destroyed. Its existence was discovered by various individuals over time. Albus Dumbledore stumbled upon it by chance when he was in urgent need of a lavatory. Fred and George Weasley used it as a hiding place from Argus Filch, and Dobby the house-elf knew of it and told Harry Potter how to find it.
The Room of Requirement plays a pivotal role in the second half of the series:
In the film adaptations, the entrance to the Room of Requirement is depicted as a complex, mechanical wall of shifting gears and stone, a visual element not described in the novels (film). During the Battle of Hogwarts sequence in the final film, the character of Gregory Goyle casts the Fiendfyre that destroys the room, a change from the book where Vincent Crabbe is responsible. This change was made because the actor playing Crabbe was unavailable for filming (film).